Yunus Emre ALPÖZEN [MCAD.NET]
2005-05-03 03:58:00 AM
Using placeholder is a solution. But generally not a wanted one. Because you
would like to display something nearby textboxes.
My advice u to use a repeater. By this way you can easily separate your
design and code.
You can use any collection to bind it. no need to use a datatable or a
dataset. For instance, just use an arraylist. And fill arraylist with
indexes.
ArrayList al = new ArrayList();
for(int i=0;i<20;i++) al.Add();
repeater1.DataSource=al;
repeater1.DataBind();
--
Thanks,
Yunus Emre ALPÖZEN
BSc, MCAD.NET
"Roger Helliwell" <
rhelliwell@telus.net>wrote in message
news:
rdvc715flddgqvbu8qj0f298lm2rldd7s7@4ax.com...
>On Mon, 02 May 2005 16:09:09 -0300 in
>microsoft.public.dotnet.framework.aspnet, Andr?Nobre <
no@spam.com>
>wrote:
>
>>Hi all...
>>
>>I need to put 20 textbox in an aspx, but I don't want to put it
>>manually. How can I code a Sub to do that? Something like a For. I tried
>>using a For and puting the asp:textbox code inside a asp:label. It
>>didn't worked. Can I use DataList ou Repeater with a fixed number os
>>repetitions, not based on DataSet or DataTable?
>>
>
>Hi Andre,
>
>If you want to stick with your 'for loop' strategy, you could put a
><asp:PlaceHolder>control on your page and in your code-behind, add
>each new TextBox to the Controls collection of the placeholder.
>
>TextBox tb = null;
>for (int i=0; i < 20; i++)
>{
>tb = new TextBox();
>// customize each textbox as you see fit
>PlaceHolder1.Controls.Add(tb);
>}
>
>Hope that gets you start.
>
>Roger