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
Hello,
If you are sure that you have managed only Appearance objects of rows of your first grid, then you could set same appearance from corresponding rows to the second grid. I’ve implement this in the attached sample. I hope that this will helps you.
Thank you for using Infragistics Components.
to comment on the other stmt, all of our formatting of the grid happens via timer like a refresh. we don't do it in the initializerow event. Sounds like this would be a much better strategy then i could subscribe to it from other grids.
this is an old and fairly complex app that's been handed down a few times. i'm trying to provide additional functionality without muddy'ing this app any further.
i see where you're going with it but it's not working for me. the 2ndary grid is on a seperate non modal form. So that form class has an UltraGridLayout (_ul) object which is being passed in from the parent form via constructor.
so when i bind the grid...i set the datasource, After which if i take the _ul object for my layout. using CopyFrom, or just setting the layout.
parentgrid: ultraGridWatch.DisplayLayout.Bands[1].Layout;
i try to copy that layout and set as my secondary grid.
ultraGridUnPriced.DataSource = unpricedRows; ultraGridUnPriced.DataBind(); if (_ul != null) ultraGridUnPriced.DisplayLayout.CopyFrom(_ul,PropertyCategories.All);
what am i missing? is there something else i should be providing?
thank you again for your help
Save/Load layout will works only if both of your grid have same data schema and data, in your case in your second grid first band is missing. So what you could do in your case is to create layout of the second grid, based on the band 1 of the first grid. You could use code like:
ultraGrid1.DisplayLayout.CopyFrom(ultraGridWatch.DisplayLayout .Bands[0].Layout , PropertyCategories.All );
Also if the appearance was managed on a row or cell level then you should re-evaluate them for the second grid. In this case my suggestion is to subscribe second grid for same delegate which firs grid uses.
I hope that this will helps you.
...forgot to mention. i did try formatting with the initializerow event, it did not do what i hoped. not all the formatting of the main grid was done with initializerow event.
most of it was done in other methods, row colors were constantly changing, columns were hidden, filterable, font was changed.
i was hoping to capture those attributes.
have a good weekend