How to get selected value of asp.net dropdown and store in session variable?

Dim ename As String = DropDownList.SelectedItem.Value

      

this expression doesn't work any help is appreciated!

+2


a source to share


3 answers


I'm not sure if this is your problem, but if you are looking for element text (instead of value) you need DropDownList.SelectedItem.Text

.

To save the session, you can simply use



Session("yourKey") = DropDownList.SelectedItem.Value

+4


a source


I tried DropDownList.SelectedItem.ToString () and it worked. I tried it without parentheses too and it still works visually. I hope this works for you too.



0


a source


You need to store the value in a session variable, not just a String variable:

Dim ename As String = DropDownList.SelectedItem.Value

Session("yourKey") = ename 

      

0


a source







All Articles