getting the RadGrid checkbox column value in server

Arvind picture Arvind · Jul 26, 2012 · Viewed 7.4k times · Source

I have a RadGrid having a checkbox column, i have added the column as a ItemTemplate to make it editable in the regular mode.

 <telerik:GridTemplateColumn UniqueName="IsSelected" DataField="IsSelected">
     <ItemTemplate>
       <asp:CheckBox ID="chkBoolean" runat="server" Checked='<%# Convert.ToBoolean(Eval("IsSelected")) %>'Enabled='<%# Convert.ToBoolean(Eval("IsSelectionDisable")) %>' />
     </ItemTemplate>
 </telerik:GridTemplateColumn>

Using this I am able to display a checkbox as editable. Now my problem is how do i get the checked value of the checkox for saving it when the user has changed the checkbox. On click of a button i need to get all the rows that are still checked and save them. The below code does not work as it does not get the checkbox. Is there any way possible to get the value.

foreach (GridDataItem item in rgUnavailResult.MasterTableView.Items)
{
       (CheckBox)item["IsSelected"].Controls[0]            
}

Thanks

Answer

Arvind picture Arvind · Jul 26, 2012

Found the checkbox

((System.Web.UI.WebControls.CheckBox)(item["IsSelected"].FindControl("chkBoolean")))