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?
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top