I find the result which I need
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Partial Public Class [Default2]
Inherits System.Web.UI.Page
Private numOfColumns As Integer = 1
Private ctr As Integer = 0
Private table As Table = Nothing
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
table = New Table()
table.ID = "tableBuild"
Session("table") = table
ViewState("ctr") = ctr
End If
ctr = CType(ViewState("ctr"), Int32)
table = DirectCast(Session("table"), Table)
Panel1.Controls.Add(table)
End Sub
Private Sub GenerateTable(ByVal colsCount As Integer)
ctr += 1
Dim row As New TableRow()
Dim cell As New TableCell()
Dim tb As New TextBox()
tb.ID = "TextBoxRow_" & ctr
tb.Width = 80
cell.Controls.Add(tb)
row.Cells.Add(cell)
Dim cell1 As New TableCell()
Dim dd As New DropDownList
dd.ID = "dd1" & ctr
dd.Width = 80
Dim tb1 As New TextBox()
tb1.ID = "TextBox1Row_" & ctr
tb1.Width = 80
cell1.Controls.Add(tb1)
cell1.Controls.Add(dd)
row.Cells.Add(cell1)
table.Rows.Add(row)
Session("table") = table
ViewState("ctr") = ctr
End Sub
Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
numOfColumns = 1
GenerateTable(numOfColumns)
End Sub
End Class
Now how can I save entered data from these dynamic controls to a database?