Author: bbxrider | Posted on: 8/2/2009 11:50:47 PM | Views : 732

i'm attempting to build a drop down list with 90 years with scripting so i don't have to code all those asp:listitem's and while i'm at it i need the item selected to stay selected if i return the page

but when trying something like this
Year<asp:DropDownList id="vetDD" runat="server">
        <%  for i as integer = currYear to currYear-90 %>
        <asp:ListItem><%=i%></asp:ListItem>
        <% next  %>
i get the code blocks  not supported error, in vs2005. you can't use code blocks within asp:dropdownlist? surely there must be some (hopefully straightforward/easy) way to do this?
i've seen tutorials like below which look similar to what i'm trying

<% Dim I ...

Go to the complete details ...