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>

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>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.