GridView in a GridView

Discussion in 'ASP .Net' started by Carlos Albert, Dec 5, 2005.

  1. Hello everybody

    I'm working (or trying to, at least) with a gridview within another
    gridview, and the 'child' gridview is related with the 'parent' from a
    field.

    With a simple gridview I used to work all by codebehind (mostly because I
    get the XML from some librarys), using gridview.databind, but now I don't
    know how to populate the second gridview and relate the fields...

    Anyone could give me a hint?

    Tnx!
     
    Carlos Albert, Dec 5, 2005
    #1
    1. Advertisements

  2. Carlos Albert

    agapeton Guest

    This shouldn't really be a problem using the new data source controls.

    Otherwise, you will probably haveto play with the FindControl("Id")
    guy. Your code will probably look like

    ((GridView)gvParent.Controls[0].Controls[n].Controls[1].Controls[1].FindControl("gvChild")).DataSource...

    Thank goodness for the new controls...
     
    agapeton, Dec 6, 2005
    #2
    1. Advertisements

  3. Works great with the solution that Nalaka gave, thanks!
     
    Carlos Albert, Dec 6, 2005
    #3
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.