datagrid in datagrid

Discussion in 'ASP .Net' started by BK Kim, Feb 23, 2004.

  1. BK Kim

    BK Kim Guest

    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
     
    BK Kim, Feb 23, 2004
    #1
    1. Advertising

  2. Your post went unanswered. Have you resolved this issue?

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "BK Kim" <> wrote in message
    news:eVcb%23Zm%...
    > 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
    >
    >
    >
     
    Alvin Bruney [MVP], Mar 2, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave
    Replies:
    0
    Views:
    475
  2. =?Utf-8?B?U3VyZXNo?=
    Replies:
    0
    Views:
    546
    =?Utf-8?B?U3VyZXNo?=
    Mar 2, 2004
  3. Brian K. Williams
    Replies:
    0
    Views:
    561
    Brian K. Williams
    Mar 2, 2004
  4. Amar
    Replies:
    0
    Views:
    574
  5. Andreas Klemt
    Replies:
    0
    Views:
    333
    Andreas Klemt
    Oct 8, 2003
Loading...

Share This Page