Reputation: 167
I have a dropdownlist with a datatext field name country and a datavaluefield named countryid.
I need to get the datavaluefield's value and store it in an sql table "mytable", based on the selectedindexchanged event of the dropdownlist.
Please keep the code in C#.
Upvotes: 3
Views: 2853
Reputation: 66
string value = ddl.SelectedItem.Text;
*This will return the selected item's text in value, which you can use in your db statements *
Upvotes: 0
Reputation: 14771
Use the following:
requestedValue = dropDownList.SelectedValue;
Upvotes: 1