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
31
How do I access a grid "child" rows in C#
posted

Hi

We need a C# solution here. Can't use JavaScript.

I have a page with two grids. The main grid is a combination of hierarchy rows and flat rows and is unbound. The user will select rows in the main grid and click an Add button to copy the rows from the main grid to a second grid. This second grid is flat.

My code is traversing the parent rows just fine. What I want to do is check to see if a parent rows has children, then cycle through the children checking to see if they are selected. If selected, copy the data to the second grid and continue processing.

I can't figure out how to traverse the children rows in band 1. I found code that enumerates the entire band but is not exactly what I want.

 Thanks for any help!

Terry

 

Parents
  • 28464
    Verified Answer
    posted

     Hello Terry,

    I believe you can take advantage of the HasChildRows property and the Rows collection of each row. For example:

     foreach (UltraGridRow row in UltraWebGrid1.Rows)
                {
                    if (row.HasChildRows)
                    {
                        foreach (UltraGridRow childRow in row.Rows)
                        {
                            // do something
                        }
                    }
                }

     Sample code in a real-world scenario using these properties / collections can be found in this  forum thread:

    http://forums.infragistics.com/forums/p/7105/29448.aspx#29448 

Reply Children
No Data