Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Basic dynamic repeating form element in ASP.NET2.0?

Reply
Thread Tools

Basic dynamic repeating form element in ASP.NET2.0?

 
 
mj.redfox.mj@gmail.com
Guest
Posts: n/a
 
      04-26-2007
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

 
Reply With Quote
 
 
 
 
David
Guest
Posts: n/a
 
      04-26-2007
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



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
>



 
Reply With Quote
 
 
 
 
mj.redfox.mj@gmail.com
Guest
Posts: n/a
 
      04-27-2007
Many thanks Dave, appreciated.


On 26 Apr, 14:39, "David"
<(E-Mail Removed)> 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
>
> <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) 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 -



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to Update/insert an xml element's text----> (<element>text</element>) HANM XML 2 01-29-2008 03:31 PM
Repeating element string parsing and iteration throwaway43054@gmail.com Perl Misc 3 11-15-2007 10:57 PM
moving from form element to form element Rod Snyder ASP .Net 1 05-29-2004 01:55 PM
container elements for repeating elements ('element farms') needed? Wolfgang Lipp XML 1 01-30-2004 04:09 PM
container elements for repeating elements ('element farms') needed? Wolfgang Lipp XML 0 01-28-2004 02:50 PM



Advertisments