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

Discussion in 'ASP .Net' started by mj.redfox.mj@gmail.com, Apr 26, 2007.

  1. Guest

    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
     
    , Apr 26, 2007
    #1
    1. Advertising

  2. David Guest

    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



    <> wrote in message
    news:...
    > 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, Apr 26, 2007
    #2
    1. Advertising

  3. Guest

    Many thanks Dave, appreciated.


    On 26 Apr, 14:39, "David"
    <> 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
    >
    > <> wrote in message
    >
    > news:...
    >
    >
    >
    > > 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 -
     
    , Apr 27, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Wolfgang Lipp
    Replies:
    1
    Views:
    411
    Patrick TJ McPhee
    Jan 30, 2004
  2. Wolfgang Lipp
    Replies:
    0
    Views:
    491
    Wolfgang Lipp
    Jan 28, 2004
  3. Sri Reddy
    Replies:
    5
    Views:
    6,394
    prashiddha
    Dec 15, 2011
  4. Sri Reddy
    Replies:
    3
    Views:
    370
    Jules
    Jun 21, 2006
  5. Sri Reddy

    Dynamic Menu Control in ASP.NET2

    Sri Reddy, May 2, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    481
    Kelly Leahy
    May 2, 2006
Loading...

Share This Page