I have a Telerik RadGrid with a GridTemplateColumn that contains a checkbox:
<telerik:GridTemplateColumn HeaderText="MINE" UniqueName="MyTemplateColumn">
<ItemTemplate>
<asp:CheckBox id="MyCheckBox" runat="server"></asp:CheckBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
I want to check the checked box based on the value read from the database. I could handle the ItemDataBound event and read the database when each row is bound, but this leads to n searches. Instead, I want to process a DataBound, and then set all the values at once. So, in this method, I want the code to look like this:
foreach(var chkbox in MyRadGrid.MasterTableView.Columns.FindByUniqueName("MyTemplateColumn").FindControl("MyCheckBox")) {
chkbox.Checked = oneValue;
}
This does not work, because FindControl is not a GridColumn method, and it will not generate an iterable list of flags. What is the correct way to iterate using checkboxes in a template column? Thank!