Author: immortalali@msn.com | Posted on: 10/13/2008 6:07:52 AM | Views : 425

Hi,
I am trying to get the selected value of my drop down list and save it into a string variable.
I have tried the following:
1) string xyz = dropDownListOne.SelectedValue;
2) string xyz = dropDownListOne.SelectedItem;
3) string xyz = dropDownListOne.SelectedValue.ToString();
4) string xyz = dropDownListOne.SelectedItem.ToString();
I googled for the solution and also tried:
5) string xyz = Request.Form["dropDownListOne"];

 
Note:
1) The dropDownListOne gets the listed items in the list from a MS SQL database.
2) the item is selectd dynamically when the page loads from the line:
dropDownListOne.SelectedValue = "Item Number One";
 
all the ways i have tried i get an empty string. That is string xyz always stays empty. but on the page value changes to the value "Item Number One", so the values is changing dynamically. but it is not being read by the ...

Go to the complete details ...