Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Add Row to datatable bound to gridview inside a gridview

Thread Tools

Add Row to datatable bound to gridview inside a gridview

Elmo Watson
Posts: n/a
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()
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()

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

I have tried for hours and have not come up with a way to do this - can
someone help me out here?

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DataTable - Add New Row as First Row Paul ASP .Net 1 07-11-2008 08:18 PM
GridView bound to a Datatable results in runtime error on attempts topage. Options ASP .Net 2 01-29-2008 09:22 AM
Gridview bound to Datatable. Update doesn't work, need help ASP .Net 2 02-19-2007 02:24 PM
GridView bound DataTable - how to get updates working? Tomasz Jastrzebski ASP .Net 4 12-08-2006 12:39 PM
How can I add a row from a typed datatable to another instance of that typed datatable? Ersin Gençtürk ASP .Net 1 10-06-2004 01:11 PM