Hello,
I have a webdatagrid in which one of my columns is select all with a checkbox in the header row and as well as in the Template row.In my checked changed event of the header checkbox , i need to check all and deselect if unchecked. How do I reference the headerrow checkbox in my checked changed event?
<ig:TemplateDataField Key="Select" Width="15px">
<HeaderTemplate>
<asp:CheckBox ID="cbSelectAll" runat="server" AutoPostBack="True" OnCheckedChanged="chkSelectAll_Checked"/>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkRowSelection"/>
</ItemTemplate>
</ig:TemplateDataField>
I am trying something like this:
protected
void chkSelectAll_Checked(object sender,EventArgs e)
{
//if header select is checked then check all else uncheck all
chk.Checked =
true;
}
How do I reference the header row checkbox and handle the event
Hello ssvan,
Let me know if you need further assistance with your question.
If your control is inserted in a templated column you may try to access it (the header CheckBox) from code behind like this:
protected void <your event>(...)
WebDataGrid1.EnsureTemplates();
TemplateDataField col = (TemplateDataField)WebDataGrid1.Columns[0];
TemplateContainer headerTemplate = col.Header.TemplateContainer;
CheckBox chk = (CheckBox)headerTemplate.FindControl("cbSelectAll");
// your code here
Let me know if you have any further questions.
Hi,
See this post: http://community.infragistics.com/forums/p/31978/175907.aspx#175907
Hopefully it works in your version.
Ed