Hi,

I have a table (GridView from ASP.NET) which has a checkbox in every
row and a Delete-Button in the header. Now this button should only be
enabled when at least one checkbox is checked, without any elements
being checked, it should be disabled.

So here's the button:
       <asp:Button runat="server" ID="DeleteButton"
Text="L&ouml;schen" tooltip="Markierte Dateien löschen"
disabled="disabled"/>

And here's my js:
function SetDeleteStatus()
{
        var foo="disabled";
   $("#gvFolderItems input:checkbox").attr("checked",function()
        {if (this.checked) {foo="";}
        }
        )
                $("#DeleteButton").disabled=foo;
                alert("deletebutton=" + foo);
}

...and the Checkboxes have an onClick="SetDeleteStatus();".

1) Using the alert, I have verified that foo is set correctly, yet
somehow it does not change the status of the button - it always
remains disabled. This is probably not even a JSQuery-prob, but maybe
somebody has an idea anyway? ;)

2) Currently I am looping through all checkboxes - this is probably
not the most efficient solution, as it could break after finding the
first checked checkbox. Or perhaps this could be done better by
checking the length of a filter()-statement's result? What do you
recommend?

Thanks

Michael

Reply via email to