468,272 Members | 2,000 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,272 developers. It's quick & easy.

datagrid in datagrid

Hello.

I am trying to use dataGrid in a dataGrid, meaning first DataGrid displays
some information and on each row, it is going to have another datagrid to
display detailed information.

I was able to do it in two dataGrid. ( one datagrid containing a datagrid in
each row )

But I was not able to do it in three dataGrid.

Generally, I bind the first DataGrid and on ItemCreated event, I add a cell
into that row containing dataGrid. ( works fine )

private void grdTemp_ItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)

{

if( e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem )

{

System.Web.UI.WebControls.DataGrid grdTemp2 = new DataGrid();

grdTemp2.ItemCreated += new
System.Web.UI.WebControls.DataGridItemEventHandler (this.grdTemp2_ItemCreated
);

e.Item.Cells[0].Controls.Add(grdTemp2);
grdTemp2.DataSource = getData(2);

grdTemp2.DataBind();

}
}

private void grdTemp2_ItemCreated(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)

{

if( e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem )

{

System.Web.UI.WebControls.DataGrid grdTemp3 = new DataGrid();
grdTemp3.DataSource = getData(3);

grdTemp3.DataBind();

e.Item.Cells[0].Controls.Add(grdTemp3);
}

}
Does anyone knows, how to do this or why this code doesn't work?
Thanx in advance

Nov 18 '05 #1
0 1166

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Bill C. | last post: by
2 posts views Thread by pei_world | last post: by
3 posts views Thread by CVerma | last post: by
2 posts views Thread by CSL | last post: by
7 posts views Thread by Dave | last post: by
9 posts views Thread by rn5a | last post: by
2 posts views Thread by =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by zattat | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.