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
364
Getting rows in a Band
posted

Hi,

 I have a hierachical grid and each band has a column called SEQUENCE which basically contains a number so that I can hold the order of the rows when the data is stored in the database.

 When I order/sort the band by various columns I want to update this SEQUENCE column so that each row has this columns value updated that is +1 previous row value. I assume I would do this in the AfterSortChange event where I would get the rows in the band that the click occured and update the rows according.

 How do I get the rows in a specific band? Is this the best way to do what I want or is there an alternative?

 Thanks in advance,

Nish

  • 469350
    Verified Answer
    Offline posted

    Hi Nish,

        For the root band, this is easy, you just use grid.Rows.

        For any other band, this is not so easy, because there is no single collection that contains the rows, they are broken up into a collection for each parent row. So you would essentially have to loop through the parent rows and then recursively walk down through every row in the grid.

        You might be able to save yourself a lot of coding by using the grid.Rows.GetRowsEnumerator method - this will return rows up to a certain level.