Friday, October 29, 2010

Which Templated Checkboxes in an Infragistics Webdatagrid Column are Checked

This is the codebehind I use to see which templated checkboxes in an infragistics webdatagrid column are checked.
 
private void TakeActionOnSelectedCustomers ()
{
if (igWdgCustomers.Rows.Count != 0)
{
foreach (GridRecord row in igWdgCustomers.Rows)
{
CheckBox theCB = (CheckBox)row.Items[0].FindControl("cbSelect");
if ( theCB!= null && theCB.Checked)
// check for null because footer row doesn’t have cb

{
// take action
}
}
}
}

This is the column being checked.

<ig:TemplateDataField Key="cbSelect" width="30px">
<Header Text=" " />
<ItemTemplate>
<asp:CheckBox ID="cbSelect" runat="server" />
</ItemTemplate>
</ig:TemplateDataField>


In this case the checkbox is not databound, but it could be.

I have not found a way to use the CRUD feature of the datasource that the WebDataGrid uses to update the db value of a boolean represented by a databound checkbox.

1 comment:

  1. Hi can you help me with WebHierarchicalDataGrid facing issue to find the column values and controls form child grid or bands.

    ReplyDelete