Add Row to datatable bound to gridview inside a gridview

Discussion in 'ASP .Net' started by Elmo Watson, Aug 17, 2006.

  1. Elmo Watson

    Elmo Watson Guest

    OK - main gridview - gvTV
    In one column - I have another Gridview - gvTRPTV - function:


    Public Function AddTRPRow() As DataTable
    dtHeader = CType(ViewState("Header"), DataTable)
    If dtHeader Is Nothing Then
    dtHeader = New DataTable("Header")
    ViewState("Header") = dtHeader
    End If
    Row = dtHeader.NewRow()
    dtHeader.Rows.Add(Row)
    AddTRPRow = dtHeader
    End Function

    In RowDataBound event of Main GridView, I have:
    Dim TRPgv As GridView = CType(e.Row.FindControl("gvTRP"), GridView)
    TRPgv.DataSource = AddTRPRow()
    TRPgv.DataBind()

    What I also have is a Linkbutton, above the internal Gridview, for the user
    to add another Row to the Datatable, and thus, add it to the internal
    GridView.

    I have tried for hours and have not come up with a way to do this - can
    someone help me out here?
     
    Elmo Watson, Aug 17, 2006
    #1
    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.