Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Basic dynamic repeating form element in ASP.NET2.0? (http://www.velocityreviews.com/forums/t499456-basic-dynamic-repeating-form-element-in-asp-net2-0-a.html)

mj.redfox.mj@gmail.com 04-26-2007 01:12 PM

Basic dynamic repeating form element in ASP.NET2.0?
 
Does anyone know how I can do the following sort of thing (written in
classic ASP), but in ASP.NET?

This is a very, very basic repeating form element which uses a counter
'cntItems' to hold the current selected number of repeats:


<% for intCounter = 1 to cntItems %>

<input type="text" name="txtInput<% =intCounter %>">
<br>

<% next %>


This would create a list of textboxes named 'txtInput1' through to
e.g. 'txtInput8' if the value of cntItems happens to be 8. I just
can't seem to find any examples of this being done in .NET, any advice
much appreciated!

Thanks, Mark


David 04-26-2007 01:39 PM

Re: Basic dynamic repeating form element in ASP.NET2.0?
 
something along the lines of...

TextBox tb;
for (count = 1; count <= cntItems; count++)
{
tb = new TextBox();
tb.ID = "txtInput" + count.ToString();
Page.Controls.Add(tb);
Page.Controls.Add(new LiteralControl("<br/>");
}


--
Best regards,
Dave Colliver.
http://www.AshfieldFOCUS.com
~~
http://www.FOCUSPortals.com - Local franchises available



<mj.redfox.mj@gmail.com> wrote in message
news:1177593143.328199.188680@r3g2000prh.googlegro ups.com...
> Does anyone know how I can do the following sort of thing (written in
> classic ASP), but in ASP.NET?
>
> This is a very, very basic repeating form element which uses a counter
> 'cntItems' to hold the current selected number of repeats:
>
>
> <% for intCounter = 1 to cntItems %>
>
> <input type="text" name="txtInput<% =intCounter %>">
> <br>
>
> <% next %>
>
>
> This would create a list of textboxes named 'txtInput1' through to
> e.g. 'txtInput8' if the value of cntItems happens to be 8. I just
> can't seem to find any examples of this being done in .NET, any advice
> much appreciated!
>
> Thanks, Mark
>




mj.redfox.mj@gmail.com 04-27-2007 08:51 AM

Re: Basic dynamic repeating form element in ASP.NET2.0?
 
Many thanks Dave, appreciated.


On 26 Apr, 14:39, "David"
<david.colliver.N...@revilloc.REMOVETHIS.com> wrote:
> something along the lines of...
>
> TextBox tb;
> for (count = 1; count <= cntItems; count++)
> {
> tb = new TextBox();
> tb.ID = "txtInput" + count.ToString();
> Page.Controls.Add(tb);
> Page.Controls.Add(new LiteralControl("<br/>");
>
> }
>
> --
> Best regards,
> Dave Colliver.http://www.AshfieldFOCUS.com
> ~~http://www.FOCUSPortals.com- Local franchises available
>
> <mj.redfox...@gmail.com> wrote in message
>
> news:1177593143.328199.188680@r3g2000prh.googlegro ups.com...
>
>
>
> > Does anyone know how I can do the following sort of thing (written in
> > classic ASP), but inASP.NET?

>
> > This is a very, very basicrepeatingformelement which uses a counter
> > 'cntItems' to hold the current selected number of repeats:

>
> > <% for intCounter = 1 to cntItems %>

>
> > <input type="text" name="txtInput<% =intCounter %>">
> > <br>

>
> > <% next %>

>
> > This would create a list of textboxes named 'txtInput1' through to
> > e.g. 'txtInput8' if the value of cntItems happens to be 8. I just
> > can't seem to find any examples of this being done in .NET, any advice
> > much appreciated!

>
> > Thanks, Mark- Hide quoted text -

>
> - Show quoted text -





All times are GMT. The time now is 03:56 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.