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
8920
Expanding child grids programmatically
posted

Attached test01 project and I need you to help me with the following :

Currently when UnoHGrid.aspx is run and Tab2 is chosen you would see a hierarchical grid

With all child grid collapsed. While I am aware of the InitialExpandDepth="1"

 property that would expand all child grids when they got initialized, it does not work in my production project that has seven tabs and lots of controls and truck load data from the sql server..  I cannot send it and if I take the page and remove all db dependencies it started to work.

Here what I need you to show me how I can expand child grid programmatically .. on the grid initialization event and on the tab activation. so the user would see the grid expanded on the opening…  (Claymation & defaults removed bc of the size) 

 test01.zip

Parents
  • 3520
    Offline posted

    Hello Michael,

    What I can suggest to address your requirements is that you subscribe for the Load event of either the WebHierarchicalDataGrid or the TabItem (or even the RowInitialize) and then go through the parent rows and expand them if they have children. The code should look similar to the following:

    protected void grid_Load(object sender, EventArgs e)
    {
    	foreach (ContainerGridRecord parentRow in grid.GridView.Rows)
    	{
    		if (parentRow.HasRowIslands)
    		{
    			parentRow.Expanded = true;
    		}
    	}
    }
    

    Please, review this approach and let us know if you need further assistance on this matter.

Reply Children