473,320 Members | 1,814 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

Apr 26 '07 #1
2 1542
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**********@gmail.comwrote in message
news:11**********************@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

Apr 26 '07 #2
Many thanks Dave, appreciated.
On 26 Apr, 14:39, "David"
<david.colliver.N...@revilloc.REMOVETHIS.comwrot e:
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.comwrote in message

news:11**********************@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 -

Apr 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wolfgang Lipp | last post by:
my question is: do we need container elements for repeating elements in data-centric xml documents? or is it for some reason very advisable to introduce containers in xml documents even where not...
3
by: Scott | last post by:
Relative newbie here, I'm looking to display the value of radio buttons and check boxes on the page before submission. So far I can do most of it. When "Hat" is checked there are to be no color...
2
by: Dave A | last post by:
I just don't get this... If I need to dynamically load controls into a web page I simply need to go PlaceHolder1.Controls.Add(new Button()); or similar. However when I need to dynamically...
6
by: lloyduh234 | last post by:
Is there a way to dynamically create user scoped settings? For example, a lookup window inside an MDI application that is called by multiple forms and needs to maintain it's size and position based...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.