Hi Everyone,
How to loop through the bound checkboxes in the template column
I have checkboxes in the radgrid which are bound to a table. They have to be editable.
Later I need to loop through them to find out whether they are checked or not and then depending on that I have to update the database.
Please tell me how to go about this.
The code snippet is as follows:
<telerik:radgrid id="RadGrid1" runat="server" allowpaging="True" gridlines="None" autogeneratecolumns="False" skin="Default2006" showstatusbar="True" >
<clientsettings allowcolumnsreorder="True" reordercolumnsonclient="True">
</clientsettings>
<mastertableview datakeynames="MenuSysID" commanditemdisplay="Top">
<commanditemtemplate>
<div style="padding: 10px 0px;">
<asp:linkbutton runat="server" id="lnkEdit" commandname="Save">
<img style="border:0px;vertical-align:middle;" alt="" src="Img/icon_edit.gif" />
Save
</asp:linkbutton>
</commanditemtemplate>
<columns>
<telerik:gridtemplatecolumn datafield="MenuCaption" forceextractvalue="Always" headertext="Menu"
uniquename="MenuCaption">
<itemtemplate>
<asp:label id="MenuCaptionLabel" runat="server" text='<%# Eval("MenuCaption") %>'></asp:label>
</itemtemplate>
</telerik:gridtemplatecolumn>
<telerik:gridtemplatecolumn headertext="Input" uniquename="TemplateColumn1">
<itemtemplate>
<asp:checkbox id="CheckBox1" runat="server" checked='<%# Eval("Input") %>' />
</itemtemplate>
<edititemtemplate>
<asp:checkbox id="CheckBox1" runat="server" checked='<%# Eval("Input") %>' />
</edititemtemplate>
</telerik:gridtemplatecolumn>
<telerik:gridtemplatecolumn headertext="Approve" uniquename="TemplateColumn2">
<itemtemplate>
<asp:checkbox id="CheckBox2" runat="server" checked='<%# Eval("Approve") %>' />
</itemtemplate>
<edititemtemplate>
<asp:checkbox id="CheckBox2" runat="server" checked='<%# Eval("Approve") %>' />
</edititemtemplate>
</telerik:gridtemplatecolumn>
<telerik:gridtemplatecolumn headertext="Delete" uniquename="TemplateColumn3">
<itemtemplate>
<asp:checkbox id="CheckBox3" runat="server" checked='<%# Eval("Delete") %>' />
</itemtemplate>
<edititemtemplate>
<asp:checkbox id="CheckBox3" runat="server" checked='<%# Eval("Delete") %>' />
</edititemtemplate>
</telerik:gridtemplatecolumn>
<telerik:gridtemplatecolumn headertext="View" uniquename="TemplateColumn">
<itemtemplate>
<asp:checkbox id="CheckBox4" runat="server" checked='<%# Eval("View") %>' />
</itemtemplate>
<edititemtemplate>
<asp:checkbox id="CheckBox4" runat="server" checked='<%# Eval("View") %>' />
</edititemtemplate>
</telerik:gridtemplatecolumn>
</columns>
<expandcollapsecolumn resizable="False" visible="False">
<headerstyle width="20px" />
</expandcollapsecolumn>
<rowindicatorcolumn visible="False">
<headerstyle width="20px" />
</rowindicatorcolumn>
</mastertableview>
</telerik:radgrid>