We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

persisting view in GDBG and GGC

Hi,
I'm loading data into grids from an xml file. I'm alternatively setting the data source to different tables in the DataSet. How do I keep the data I've retrieved from on data source still in view and add to it data from another data source (same table structure)? I want to build up a 'union' of values pulled from separate tables.

Thanks,

3 Replies

AD Administrator Syncfusion Team December 6, 2006 04:40 AM UTC

Hi Dimitri,

This can be acheived by adding GridBoundColumns for the columns that you want to see from either table to the grid. Then make one table the grid’s datasource and use grid.Model.QueryCellInfo to dynamically provide the values from the other table. If you want to handle editing, you would also have to handle SaveCellInfo. Please refer to tha attached sample for implementation.

Here is the link for the sample:
GDBG_DisplayDataFromMultipleTables.zip

Best Regards,
Haneef


AD Administrator Syncfusion Team December 8, 2006 08:47 PM UTC

Okay, thanks Haneef,
Actually, the word I should have used is 'append' data from a different table to the live column on display. Does you sample show this?




AD Administrator Syncfusion Team December 11, 2006 01:11 PM UTC

Hi Dimitri,

You can handle the QueryCellInfo event to provide values to the grid andalso handle the SaveCellInfo to store any changed values to underlying datasource from the grid. Please refer to the attached sample for more details.

private void Model_QueryCellInfo(object sender, Syncfusion.Windows.Forms.Grid.GridQueryCellInfoEventArgs e)
{
if(e.ColIndex > 0 && e.RowIndex > 0)
{
GridModel model = sender as GridModel;
if( e.RowIndex > model.RowCount /2 )
e.Style.CellValue = table1.Rows[e.RowIndex -3 ][e.ColIndex -1];
else
e.Style.CellValue = table2.Rows[e.RowIndex - 1 ][e.ColIndex -1];
e.Handled = true;
}
}


Here is a sample.
CS.zip

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon