<%@ Page Language=VB Debug=true %>
<script runat=server>
Sub Page_Load(ByVal Sender as Object, ByVal E as EventArgs)
End Sub
Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
Dim I as Integer
For I = 1 to txtNumber.Text
Dim MyTextBox = New TextBox
MyTextBox.ID = "txtDynamic" & I
MyTextBox.Text = "Control Number: " & I
frmMyPage.Controls.Add(MyTextBox)
Dim MyLiteral = New LiteralControl
MyLiteral.Text = "<BR><BR>"
frmMyPage.Controls.Add(MyLiteral)
Next
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Creating a Basic TextBox Control</TITLE>
</HEAD>
<form
id="frmMyPage"
runat="server"
>
Enter the number of TextBox controls you want:<BR>
<asp:TextBox
id="txtNumber"
Columns="25"
MaxLength="3"
runat=server
/>
<BR><BR>
<asp:button
id="butOK"
text="OK"
Type="Submit"
OnClick="SubmitBtn_Click"
runat="server"
/>
<BR><BR>
</Form>
</BODY>
</HTML>
|