Forums

This topic is locked

SELECTED in dynamic select problem

Posted 06 Aug 2002 16:54:07
1
has voted
06 Aug 2002 16:54:07 Peter Elkjaer posted:
Hi, I have a dynamic select menu.

It works fine - but the "selected" function does not.

When I choose an option and the page loads, I want the option I chose to be
selected, but the last option is always selected.

<select name="selMainMenu" id="selMainMenu"
onChange="document.location.href='/cms/editor.asp?MainMenuId='+this.options[
this.selectedIndex].value;">
<option value="" <%If (Not
isNull((rsMenuSel.Fields.Item("MainMenuId".Value))) Then If ("" =
CStr((rsMenuSel.Fields.Item("MainMenuId".Value))) Then
Response.Write("SELECTED" : Response.Write(""%>>Vælg menupunkt</option>
<%
While (NOT rsMenuSel.EOF)
%>
<option value="<%=(rsMenuSel.Fields.Item("MainMenuId".Value)%>" <%If (Not
isNull((rsMenuSel.Fields.Item("MainMenuId".Value))) Then If
(CStr(rsMenuSel.Fields.Item("MainMenuId".Value) =
CStr((rsMenuSel.Fields.Item("MainMenuId".Value))) Then
Response.Write("SELECTED" : Response.Write(""%>
><%=(rsMenuSel.Fields.Item("MenuTitle".Value)%></option>
<%
rsMenuSel.MoveNext()
Wend
If (rsMenuSel.CursorType > 0) Then
rsMenuSel.MoveFirst
Else
rsMenuSel.Requery
End If
%>
</select>

Reply to this topic