how to get the selected value of dropdown list of asp.net and store in session variable?
Dim ename As String = DropDow开发者_运维问答nList.SelectedItem.Value
this statement is'nt working any help is appreciated!!
I'm not sure if this is your problem, but if you're looking for the text of the item (instead of the value) you need DropDownList.SelectedItem.Text
.
To store in session, you can just use
Session("yourKey") = DropDownList.SelectedItem.Value
I tried DropDownList.SelectedItem.ToString() & it worked. I tried without the parentheses too & it still work in visual basic. I hope it will work for you too.
You need to store the value into a session variable, not only in a String variable:
Dim ename As String = DropDownList.SelectedItem.Value
Session("yourKey") = ename
精彩评论