473,473 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

input control id and for loop

Hello,

I have a bunch of HTML input controls which I need to generate from
within a for loop. I would like them to have id attributes set to
values foo1, foo2, foo3, foo4, etc...

Unfortunately it seems this is not possible because ASP.NET won't
let me use ASP tags within the values of the id attribute. So
for instance I cannot just do the following:

<% for (i = 0; i < N; i++) { %>
<input id="foo<%= i %>" type="text" runat="server" />
<% } %>

The reason is that IIS will issue the following error:
Parser Error Message: Server tags cannot contain <% ... %> constructs.

I wonder whether someone could please provide some insight on
how I can solve this problem as I do need ids for the HTML
input controls so that I can validate them with ASP.NET
validation controls.

It seems to me I am coming across what seem to be limitations
in ASP.NET and what kind of programming constructs it supports...
Any help with the above would be sincerely appreciated,

Also, what would happen if several controls shared the id field.
I thought this was not possible, but when I tried it asp.net did
not complain.

Thanks,

Neil
Nov 16 '05 #1
1 2427
Neil,

It is simple, a HTML control is working on the client side
a ASPNET control is working on the server side.

And in HTML are limitations.

Something the same as that you can not book in New Yourk a room in Amsterdam
when there is no connection with Amsterdam.

However for that are a lot of solutions in ASPNet and probably can you use
the textbox id property for what you want by using a textbox servercontrol.
..

http://msdn.microsoft.com/library/de...assidtopic.asp

I hope this helps?

Cor
Nov 16 '05 #2

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

Similar topics

8
by: Oeln | last post by:
If I want to check for input of an integer I've got the following (I get the form input with $input = "$_POST"): if(!ereg("^+$",$_POST)) { echo "Input is incomplete or incorrect."; } If,...
1
by: Scott Shaw | last post by:
Hi all, I was wondering if you could help out with this problem that I am having. What I am trying to do is detect keyboard input in a while loop without halting/pausing the loop until the key is...
0
by: ntuser_man | last post by:
Howdy I'm trying to validate the content of a csv uploaded to a web page. I imported the csv into a DataSet and now I want to loop through all the elements in the DataSet to validate that each is...
1
by: Rob Meade | last post by:
Hi all, I have a loop in my code which builds the controls on the page. I at one stage need to add some hidden input controls dynamically, I have achieved this, and I have set their...
3
by: Neil Zanella | last post by:
Hello, I have a bunch of HTML input controls which I need to generate from within a for loop. I would like them to have id attributes set to values foo1, foo2, foo3, foo4, etc... ...
0
by: Diogo Bastos | last post by:
Hello, I'm fairly used to working with Python but it's the first time I'm trying to use Tkinter so I'm running into a problem. I'm using three python scripts with Tkinter GUIs and a fourth...
5
by: Kavya | last post by:
I saw these two ways for validating input First Way -------------- #include <iostream> #include <limits> using namespace std; int main() {
116
by: dmoran21 | last post by:
Hi All, I am working on a program to take input from a txt file, do some calculations, and then output the results to another txt file. The program that I've written compiles fine for me, however,...
6
by: parez | last post by:
Is there anyway i can find out if a control is an input control (textbox,radiobutton,checkbox,dropdown etc) and not a panel,group box etc. I am trying to implement "You have unsaved data on the...
27
by: =?ISO-8859-1?Q?Tom=E1s_=D3_h=C9ilidhe?= | last post by:
I have a fully-portable C program (or at least I think I do). It works fine on Windows, but malfunctions on Linux. I suspect that there's something I don't know about the standard input stream...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.