In my .aspx file, I am trying to add List Items within a Dropdown, through a script that contains a For, but I don't know how to correctly add these items. I did a test example to simplify the problem, with numbers from 1 to 10, so you can understand a little better the problem I am having
I tried this
<asp:DropDownList ID="numbers" runat="server">
<script runat="server">
void loop() {
for(int i=1; i<1=10; i++) {
<asp:ListItem>i</asp:ListItem>
}
}
</script>
</asp:DropDownList>
the error given says "the name asp does not exist in the current context"
Aucun commentaire:
Enregistrer un commentaire