I am trying to create a table which will have dynmic additions to rows, the cells in the row will have textboxes as well.
Then the user clicks on "Add new Row" the row gets added to exisitng table. The key is that the information typed in previous rows should not disappear.
There is "SAVE" button in the form as well. when the user clicks on this button the data in each row should be inserted in the database one by one. Thus the Row should accessed programitically.
I have the below code called at LinkButton Click and
Protected Overrides Sub LoadViewState(ByVal earlierState As Object)
'If Not ViewState("TableRow") Is Nothing Then
If ViewState("TableRow") = True Then
Public Sub createMyTable()
Dim rowCtr As Integer
Dim cellCtr As Integer
Dim t As TextBox
Dim rowCnt As Integer = tblDashboard.Rows.Count
If rowCnt < Session("NewCntRow") Then
rowCnt = Session("NewCntRow")
For rowCtr = 1 To rowCnt
Dim tRow As New TableRow
tRow.Height = 50
Session("NewCntRow") = tblDashboard.Rows.Count
For cellCtr = 0 To tblDashboard.Rows(0).Cells.Count - 1
t = New TextBox
't.EnableViewState = True
't.ID = "txt" & cellCtr
Dim tCell As New TableCell
ViewState("TableRow") = True