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
1365
copying a subset of rows from a grid and display on seperate grid
posted

hi,

i have an odd request. i have an app with a grid including (2 bands). this app refreshes the grid in the background and i want to take a subset of the rows from th grid and display them on another grid. hopefully including formatting from original grid.

i've tried a couple of different things with LINQ but not getting the desired result.

//first trying to get detail rows, 2nd band (band=1)

 var allRows = from r in ultraGridWatch.Rows.Where (f=>f.Band.Index==1) select r;

//then from those, literally filter on ultragridrows for cells with a specific value.
            var unpriceRows= from r in allRows
                                 where r.Cells["LAST"].Value.ToString().Trim() == ""
                                  select r;

i do believe the first query works because when i run the 2nd query it doesn't complain about "LAST" column. (whereas, just querying the first band threw an exception for that column )

ideally i just want unpriceRows to be a formatted list of the rows i filtered. Then i can copy them and display in a seperate grid.

anyone have any idea on how to achieve this?

thanks in advance

Al

Parents
No Data
Reply
  • 48586
    posted

    Hello ,

     

    Rows collection returns a collection of the topmost level of rows in the grid. This collection will either contain all the rows in Band 0 or the top level of GroupBy rows (if GroupBy rows are being used.). In other words to get rows from the second band, you should go through row from the first band and then to reach its child bands. You could use code like:

     

     List<UltraGridRow> unpriceRows = new List<UltraGridRow>();

                foreach (UltraGridRow row in ultraGridWatch.Rows)

                {

                    unpriceRows.AddRange(

                        row.ChildBands[0].Rows.Where(r => r.Cells["LAST"].Value.ToString().Trim() == "")

                    );

                }

     

    Also I think that it will be easiest and faster if you get your needed rows form the underlying data source. Can you please let me know what king of data source you are using.

     

    I am waiting for your feedback.  

Children