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.
Unfortunately, activation email could not send to your email. Please try again.

Displaying Data from two DataTables

Thread ID:

Created:

Updated:

Platform:

Replies:

21268 Nov 5,2004 07:34 AM Nov 9,2004 01:59 PM Windows Forms 5
loading
Tags: GridControl
Lalit Parashar
Asked On November 5, 2004 07:34 AM

Hi, I have a DataSet with two DataTables with the same primary key. Its not a parent-child relationship. I have seperated the data in two tables for some reason. Now, I would like to diplay all the rows from both the tables in the DataGrid. What is the quickest way of achieving that? Thanks, Lalit

Administrator [Syncfusion]
Replied On November 5, 2004 09:07 AM

If these are just 2 flat tables you want to see in a grid, then using a virtual GridControl is one way to do it. In the QueryCellInfo handler, you would provide data from either table based on the e.RowIndex passed in, by setting the e.Style.CellValue appropriately. In QueryRowCount, you would return the total of the rows in both tables.

Lalit Parashar
Replied On November 5, 2004 09:47 AM

I have Table1 (10 columns, 1 Primary key), Table2 (10 columns, 1 Primary key). I would like to see 19 columns in the grid (since primary key is same in both the tables, i.e. ID). Thanks, Lalit

Administrator [Syncfusion]
Replied On November 5, 2004 11:35 AM

You could do this either with a virtual GridControl similar to what I suggested above, or you could it with a GridDataBoundGrid. With a GridDataBoundGrid, you could just assign the DataSource to be 1 table. Then you would add 9 unbound columns (sample of how to do this in grid\samples\databound\multiheader sample). In your QueryCellInfo event, you would get the primary key value, and use it and the COlindex (or column name) to find the proper value from the second table to set into e.Style.CellValue.

Brenda Maloff
Replied On November 9, 2004 01:17 PM

I also have to do something like this. I wanted to use a GridDataBoundGrid just for ease of use, but I noticed that it doesn''t have a QueryCellInfo event. Does that mean I have to use a true virtual grid? >You could do this either with a virtual GridControl similar to what I suggested above, or you could it with a GridDataBoundGrid. > >With a GridDataBoundGrid, you could just assign the DataSource to be 1 table. Then you would add 9 unbound columns (sample of how to do this in grid\samples\databound\multiheader sample). In your QueryCellInfo event, you would get the primary key value, and use it and the COlindex (or column name) to find the proper value from the second table to set into e.Style.CellValue. > >

Administrator [Syncfusion]
Replied On November 9, 2004 01:59 PM

In GridDataBoundGrid, you would use the grid.Model.QueryCellInfo event.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;