Repeater nested checkbox

Source: Internet
Author: User

Foreground VB

<Asp: repeater id = "rptmainmenu" runat = "server">
<Headertemplate>
<Table id = "table01" width = "149" border = "0" cellspacing = "0" cellpadding = "0">
</Headertemplate>
<Itemtemplate>
<Tr class = "TR">
<TD id = "tdmanimenu">
<Asp: checkbox id = "cbxall" runat = "server" text = '<% # databinder. eval (container. dataitem, "title") %> 'oncheckedchanged = "itemcheckbox_checkedchanged" autopostback = "true" font-bold = "true"
> </ASP: checkbox>
</TD>
</Tr>
<Tr class = "TR">
<TD id = "tdmenuborder">
<Div>
<Asp: repeater id = "rptmaindetail" runat = "server">
<Itemtemplate>
<Tr>
<TD style = "padding-left: 10px">
<Asp: checkbox id = "cbxmenudetail" runat = "server" font-size = "small" text = '<% # databinder. eval (container. dataitem, "title") %>'
> </ASP: checkbox>
<Asp: hiddenfield runat = "server" id = "hidvalue" value = '<% # databinder. eval (container. dataitem, "ID") %>'/>
</TD>
</Tr>
</Itemtemplate>
</ASP: repeater>
</Div>
</TD>
</Tr>
</Itemtemplate>
<Footertemplate>
</Table>
</Footertemplate>
</ASP: repeater>

Background VB

Protected sub itemcheckbox_checkedchanged (byval sender as object, byval e as system. eventargs)
Dim I as integer = 0
Dim J as integer = 0
For I = 0 to me. rptmainmenu. Items. Count-1
Dim cbxall as checkbox = rptmainmenu. Items (I). findcontrol ("cbxall ")
Dim rptmenudetail as repeater = me. rptmainmenu. Items (I). findcontrol ("rptmaindetail ")
If sender. Equals (cbxall) then
Dim rptmenudetail as repeater = me. rptmainmenu. Items (I). findcontrol ("rptmaindetail ")
For J = 0 to rptmenudetail. Items. Count-1
Dim cbxmenudetail as checkbox = rptmenudetail. Items (j). findcontrol ("cbxmenudetail ")
Cbxmenudetail. Checked = cbxall. Checked
Next
End if next
End sub

But is there any way to control it in front-end JS? If you have any questions, please share them.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.