From: Len on
<% UVDescs(0)= "Algebra"
UVDescs(1)= "Biology"
UVDescs(2)= "English"
UVDescs(3)= "Mathimatics"
UVDescs(22)= "Physical Education"
UVDescs(23)= "Social Science"
UVDescs(24)= "Trigonometry"
UVDescs(25)= "Zoology"%>

<Select NAME="MyDropList" SIZE = "1">
<%For N = 0 to 25%>
<%If Request("Subject") = "" or IsNull(Request("Subject")) then%>
<Option Value="<%=UVDescs(N)%>"><%=UVDescs(N)%></Option>
<%Else%>
<%If Request("Subject") = UVDescs(N) then%>
<Option Selected="<%=UVDescs(N)%>"><%=UVDescs(N)%>
<%Else%>
<Option Value="<%=UVDescs(N)%>"><%=UVDescs(N)%></Option>
<%End If%>
<%End If%>
<%Next%>
</Select>

I have a school district Web Site with 23 pages. 11 of the pages gives the
parent
the ability to select the subject their child is taking. When I get to the
page to
display the subjects (The problem area is shown above), it lists the
all of the
subjects from the begining. If I selected Physical Education from a
previous page,
I want the MyDropList to show Physical Education when this page is
displayed, not Algebra.

What am I doing wrong?
From: hb21l6 on

ok, Lets see if we can reformat it a bit for you as one block of ASP.

<%
UVDescs(0)= "Algebra"
UVDescs(1)= "Biology"
UVDescs(2)= "English"
UVDescs(3)= "Mathimatics"
UVDescs(22)= "Physical Education"
UVDescs(23)= "Social Science"
UVDescs(24)= "Trigonometry"
UVDescs(25)= "Zoology"%>

response.write "<Select NAME='MyDropList' SIZE = '1'>"

For N = 0 to 25

response.write "<Option Value='" & UVDescs(N) & "'
If trim(Request("Subject")) = trim(UVDescs(N)) then
response.write " selected"
response.write >" & UVDescs(N) & "</Option>"
Next
response.write "</Select>"

%>

You want to write out all the options for the select box and only add
"select" if it finds the subject in the drop down.
On one of your lines you had <option selected=value> which is wrong. You
also had nested IF statements which isn't required.
when deailing with Text in Classic ASP, you should always trim the
variables. (just in case)

Give the script a go, let me know how you get on
Dave



"Len" <Len(a)discussions.microsoft.com> wrote in message
news:D2885415-1F76-49A2-AEC5-FF376D64D78C(a)microsoft.com...
> <% UVDescs(0)= "Algebra"
> UVDescs(1)= "Biology"
> UVDescs(2)= "English"
> UVDescs(3)= "Mathimatics"
> UVDescs(22)= "Physical Education"
> UVDescs(23)= "Social Science"
> UVDescs(24)= "Trigonometry"
> UVDescs(25)= "Zoology"%>
>
> <Select NAME="MyDropList" SIZE = "1">
> <%For N = 0 to 25%>
> <%If Request("Subject") = "" or IsNull(Request("Subject")) then%>
> <Option Value="<%=UVDescs(N)%>"><%=UVDescs(N)%></Option>
> <%Else%>
> <%If Request("Subject") = UVDescs(N) then%>
> <Option Selected="<%=UVDescs(N)%>"><%=UVDescs(N)%>
> <%Else%>
> <Option Value="<%=UVDescs(N)%>"><%=UVDescs(N)%></Option>
> <%End If%>
> <%End If%>
> <%Next%>
> </Select>
>
> I have a school district Web Site with 23 pages. 11 of the pages gives
> the
> parent
> the ability to select the subject their child is taking. When I get to
> the
> page to
> display the subjects (The problem area is shown above), it lists the
> all of the
> subjects from the begining. If I selected Physical Education from a
> previous page,
> I want the MyDropList to show Physical Education when this page is
> displayed, not Algebra.
>
> What am I doing wrong?
>

 | 
Pages: 1
Prev: split textbox
Next: Cannot locate recource error