all groups > asp.net datagrid control > november 2003 >
You're in the

asp.net datagrid control

group:

nested datagrids



nested datagrids source
11/29/2003 7:54:30 PM
asp.net datagrid control: I need to implement a grid within a grid. How can I do this.
The reason I need to do this is because I need to show related data within a
grid from two different tables.

source

Re: nested datagrids source
11/30/2003 8:40:10 AM
As a matter of fact I tried using a datagrid within the ItemTemplate, but
for some reason it did not work.
Can you tell me little more about this.


[quoted text, click to view]

Re: nested datagrids Jos
11/30/2003 9:37:51 AM
[quoted text, click to view]

Put the second grid in the ItemTemplate of the first grid.
Use the OnItemBound event of the first grid to bind the second grid.

--

Jos

Re: nested datagrids Jos
11/30/2003 7:18:07 PM
[quoted text, click to view]

In the OnItemDataBound() event for the main datagrid, find the nested
datagrid like this:

Dim ndg As DataGrid = CType(e.Item.FindControl("DataGrid2",DataGrid))

Then perform databinding on it:

ndg.DataSource=whatever (probably depending on some data in e.Item)
ndg.DataBind()

Here's some examples with repeaters instead of datagrids:
http://www.c-sharpcorner.com/Code/2002/Aug/MasterDetailedDisplay.asp
http://authors.aspalliance.com/aylar/ViewArticle.aspx?ArticleID=4&PageID=1

Here's an example with a datagrid constructed on the fly:
http://www.dotnetjunkies.com/Tutorial/47792CB0-0990-4BD8-BF84-B6063C4C9BBC.dcik


--

Jos

Re: nested datagrids IK
12/1/2003 9:17:58 AM
http://msdn.microsoft.com/msdnmag/issues/03/10/CuttingEdge/

IK

[quoted text, click to view]

AddThis Social Bookmark Button