<%@ Page Language=VB Debug=true %>
<%@ Import Namespace="Microsoft.Web.UI.WebControls" %>
<%@ Register TagPrefix="IEControls"
Namespace="Microsoft.Web.UI.WebControls"
Assembly ="Microsoft.Web.UI.WebControls"
%>
<script runat=server>
Sub OK_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
pv2.Controls.Add(MyTextBox)
Next
MyMultiPage.SelectedIndex = 1
End Sub
</SCRIPT>
<HTML>
<HEAD>
<TITLE>Adding Controls to a PageView Control in Code</TITLE>
</HEAD>
<BODY LEFTMARGIN="40">
<form runat="server">
<IEControls:multipage
id="MyMultiPage"
runat="server"
>
<IEControls:PageView
id="pv1"
runat=server
>
How many TextBox controls do you want?<BR>
<asp:textbox
id="txtNumber"
runat=server
/>
<BR>
<asp:button
id="butOK"
text=" OK "
onclick="OK_Click"
runat="server"
/>
</IEControls:PageView>
<IEControls:PageView
id="pv2"
runat=server
>
</IEControls:PageView>
</IEControls:multipage>
</form>
</BODY>
</HTML>
|