开发者

Retrieving selected item value from a dropdownlist

开发者 https://www.devze.com 2023-03-07 04:19 出处:网络
I have a dropdownlist with a datatext field name country and a datavaluefield named countryid. I need to get the开发者_JAVA百科 datavaluefield\'s value and store it in an sql table \"mytable\", base

I have a dropdownlist with a datatext field name country and a datavaluefield named countryid.

I need to get the开发者_JAVA百科 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#.


Use the following:

requestedValue = dropDownList.SelectedValue;


string value = ddl.SelectedItem.Text;

*This will return the selected item's text in value, which you can use in your db statements *

0

精彩评论

暂无评论...
验证码 换一张
取 消