c# - Javascript to loop through asp checkboxes to see if any are checked -
i having issue looping though asp checkboxes in ascx file see each individual element's "state" (checked or not). here code:
<asp:listview runat="server" id="lvapplicationforms" onitemcommand="lvattacheddocuments_onitemcommand" datakeynames="formid" onprerender="lvapplicationforms_prerender" onitemdatabound="lvapplicationforms_itemdatabound"> <itemtemplate> <tr class="<%# (container.displayindex + 1 )% 2 == 0 ? "evenrow" : "oddrow" %>" data-formname='<%#eval("formname")%>'> <td class="fieldname_td" style="text-align: center"> <asp:checkbox id="cbisexposed" runat="server" style="text-align: center" onclick="javascript:return checkedchange(this)" onchecked='<%# eval("ispublished") %>' enabled='<%# cancountersignandexpose && convert.toboolean(eval("canbepublished")) %>' /> </td> </tr> </itemtemplate> </asp:listview> essentially issue have save button on page want enabled if @ least 1 element in checkboxes checked. if none are, keep save button disabled. know how disable save button, don't know how loop though checkboxes "state".
if can add reference jquery, can done in 1 line using :checked selector
when $('#mysection input:checked'), returns array of checked checkboxes can further process required.
Comments
Post a Comment