-
Code generation
I wish to generate 100 text fields like this code:
Code:
<asp:TextBox id="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox id="TextBox2" runat="server"></asp:TextBox>
<asp:TextBox id="TextBox3" runat="server"></asp:TextBox>
<asp:TextBox id="TextBox4" runat="server"></asp:TextBox>
<asp:TextBox id="TextBox5" runat="server"></asp:TextBox>
.
.
.
<asp:TextBox id="TextBox100" runat="server"></asp:TextBox>
How can I do that without writing the code manually?
-
This would work
Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
if not page.ispostback then
buildoxes()
end if
end sub
Sub buildboxes()
dim t as textbox=new textbox
dim i as integer
for i=0 to 99
t.id="textbox" & i
page.controls.add(t)
next
end sub
-
Great, thanks! But what if I have some HTML code e.g. two tables and the I wish to place the 100 text fields a specific place in my HTML-code?
[code]
<html>
<body>
<tr>
<td>This is table one</td>
<td>This is table one</td>
</tr>
<tr>
<td>This table two</td>
<td>[here I want the 100 text fields]</td>
</tr>
</body>
</html>