N
Neil Zanella
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
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