PDA

View Full Version : Session my dropdown list


Cuttie0506
01-26-2006, 07:44 AM
Hi all..

I have a problem with session..

This is my codes for my dropdown list:


<tr>
<td>Status: </td>
<td><select name=status id=select>
<%While (NOT rs_vStatus.EOF)%>
<option value="<%=(rs_vStatus.Fields.Item("status").Value)%>"><%=(rs_vStatus.Fields.Item("status").Value)%></option>
<% rs_vStatus.MoveNext()
Wend

If (rs_vStatus.CursorType > 0) Then
rs_vStatus.MoveFirst

Else
rs_vStatus.Requery
End If %>
</select></td>
</tr>


I populate the dropdown list by retrieving data from a db table.
I have a few buttons, and whenever i click a button to generate something, the initial option that i have selected went back to the 1st option. I want to session the value that i have selected. But where should i put my session codes? I have tried using some ways, but i just wont work.. Hope some1 can help me out. Thanx!

Roelf
01-26-2006, 08:02 AM
If the click on the button posts the page to the server, you should find the selected option of your dropdown in the processing part of the page. When the page gets rebuild, you should check to find the selected option while adding all the options to the select. When the selectes option is found, then add the "selected" attribute to the option tag

Bullschmidt
01-29-2006, 10:02 PM
Perhaps this may hopefully give you some ideas and it's got a downloadable sample:

Classic ASP Design Tips - Fill a Listbox Possibly With Multiple Columns
http://www.bullschmidt.com/devtip-filllistbox.asp

Cuttie0506
02-01-2006, 02:09 AM
oKay.. Thanx!!
I got the session works.