开发者

Retrieving selected item value from a dropdownlist

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜