Add Row to datatable bound to gridview inside a gridview


E

Elmo Watson

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?
 
Ad

Advertisements


Top