A
Alan Silver
Hello,
I have a repeater that is being used to show products from a database.
Inside the ItemTemplate is a DropDownList, that contains the numbers
0-5. The user can use this to set the quantity of that product that they
wish to order.
I want to be able to do client-side validation on the quantities when
the order button is clicked. The problems are:
1) I don't know in advance how many products there will be. I tried
getting around this by writing a Javascript variable from the
server-side script and using that as the "for" limit, like this...
<script type="text/javascript">
nprods = <%= nProds %>;
for (i=0; i<nprods; i++) {
// stuff here
}
</script>
....but this gave an error because the <head> tag has a runat="server"
attribute, and the two don't seem to go together. I tried using <%# %>
instead of <%= %> (as suggested in many places), but it didn't help.
2) I also don't know what the dropdown controls will be named in
advance.
Anyone any ideas how to get around this? TIA
I have a repeater that is being used to show products from a database.
Inside the ItemTemplate is a DropDownList, that contains the numbers
0-5. The user can use this to set the quantity of that product that they
wish to order.
I want to be able to do client-side validation on the quantities when
the order button is clicked. The problems are:
1) I don't know in advance how many products there will be. I tried
getting around this by writing a Javascript variable from the
server-side script and using that as the "for" limit, like this...
<script type="text/javascript">
nprods = <%= nProds %>;
for (i=0; i<nprods; i++) {
// stuff here
}
</script>
....but this gave an error because the <head> tag has a runat="server"
attribute, and the two don't seem to go together. I tried using <%# %>
instead of <%= %> (as suggested in many places), but it didn't help.
2) I also don't know what the dropdown controls will be named in
advance.
Anyone any ideas how to get around this? TIA