B
BK Kim
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
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