Public Class TextBox1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Session("count") = 0
Dim table As Table = New Table()
table.ID = "Tab1"
Page.Form.Controls.Add(table)
Dim i As Integer
For i = 0 To 3
Dim text As TextBox = New TextBox()
text.ID = "text_" & i
Page.Form.Controls.Add(New TextBox())
Session("count") = Session("count") + 1
Next
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
If Session("count") > 0 Then
For i1 As Integer = 0 To Session("count") - 1
Dim text1 As TextBox = New TextBox()
text1.ID = "text_" & i1
Page.Form.Controls.Add(New TextBox())
If i1 >= 4 Then
If (i1 Mod 4) = 0 Then
Response.Write("
")
End If
End If
Next
End If
Response.Write("
")
For i = 0 To 3
Dim text As TextBox = New TextBox()
text.ID = "text_" & i
Page.Form.Controls.Add(New TextBox())
Session("count") = Session("count") + 1
Next
End Sub
End Class