0

Hello,

I have a dropdown list (single row only) of languages. If I select 'English", the page will reload, it will pass a variable of the Language ID, and all records in English will display in the table.
How can I retain the value selected in the dropdown? I want the selected language to be selected (displayed) in the dropdown list, not the first nor last.
Thanks in advance!

<select name="LanguageID" onchange="myForm.submit();">
<%do while not rs.eof%>
<option value="<%=rs("LanguageID")%>"><%=rs("Language")%></option>
<%rs.movenext
loop%>		
</select>
2
Contributors
1
Reply
2
Views
9 Years
Discussion Span
Last Post by SheSaidImaPregy
0

well you can always do it via querystring or session's. just set the querystring or session to the language ID. then do this:

<select name="LanguageID" onchange="myForm.submit();">
<%do while not rs.eof%>
<option value="<%=rs("LanguageID")%>" <% if Trim(Request.QueryString("languageid")) = rs("LanguageID") then %>selected<% end if %>><%=rs("Language")%></option>
<%rs.movenext
loop%>		
</select>

or session object:

<select name="LanguageID" onchange="myForm.submit();">
<%do while not rs.eof%>
<option value="<%=rs("LanguageID")%>" <% if Session("languageid") = rs("LanguageID") then %>selected<% end if %>><%=rs("Language")%></option>
<%rs.movenext
loop%>		
</select>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.