Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
810
Header Row
posted

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)

{

 

 

 

 

foreach (GridRecord gridRow in webDGCalendar.Rows)

{

 

 

CheckBox chk = (CheckBox)gridRow.Items[3].FindControl("chkRowSelection");

 

 

if (chk != null)

{

//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

Parents
No Data
Reply
  • 15979
    posted

    Hello ssvan,

    Let me know if you need further assistance with your question.

Children
No Data