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
How do I access a checkbox in WebHierarchicalDataGrid Band item template

Sorry...but I simply cannot find an answer to this question. I want to access the checkbox shown in read below in code behind.

Thanks in advance!

<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1"
ClientIDMode="Static" ViewStateMode="Disabled"
DataKeyFields="ParentOfficeId" DataMember="parent"
AutoGenerateColumns="False" runat="server"
<ig:BoundDataField DataFieldName="name" Key="name" Header-Text="Office" />
<ig:Band Key="offices" DataKeyFields="ParentOfficeId"
DataMember="child" AutoGenerateColumns="False">
<ig:TemplateDataField Key="col1" Width="20">
<asp:Label runat="server" Text="&nbsp;" />
<ig:TemplateDataField Key="SelectedOffice" Width="500px">
<asp:CheckBox ID="chkOffice" runat="server"
officeId='<%# Eval("Officeid", "{0}") %>'
Text='<%# Eval("name", "{0}") %>' />



  • 740
    Offline posted


    Thank you for posting in our community.

    To access given control inside of a template column, you can call the FindControl method on that column's cell:

    protected void Btn_Click(object sender, EventArgs e)
    	foreach (ContainerGridRecord row in whdg.Rows)
    		var rowsOfCurrentBand = row.RowIslands[0].Rows;
    		foreach (ContainerGridRecord bandRow in rowsOfCurrentBand)
    			CheckBox checkbox = bandRow.Items.FindItemByKey("CheckboxColumn").FindControl("CheckboxID") as CheckBox;
    			checkbox.Checked = true;

    I have created and attached a sample illustrating the desired behavior. When the button is clicked all checkboxes on all bands are marked as checked.

    If this is not an accurate demonstration of what you are trying to achieve please feel free to modify it and send it back to me along with steps to reproduce.