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. 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. Ersin Gençtürk
    Replies:
    1
    Views:
    3,492
    Ersin Gençtürk
    Oct 6, 2004
  2. Tomasz Jastrzebski
    Replies:
    4
    Views:
    3,776
    Walter Wang [MSFT]
    Dec 8, 2006
  3. Replies:
    2
    Views:
    930
  4. Replies:
    2
    Views:
    720
  5. Paul
    Replies:
    1
    Views:
    2,285
    Hermit Dave
    Jul 11, 2008
Loading...

Share This Page