且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在.cs页面中访问HTML DropDownlist的值

更新时间:2023-12-03 11:04:22

Do you using asp.net dropdown or html dropdown?
If you are using asp.net dropdown then dropdownname.selectedValue
If you are using html dropdown then you need to set value in any server side control on dropdown change and access that as you are access that control.


试试这一个





Try with this one


string  strSelectedValue=DropDown.selectedValue.ToString();


如果你的意思是下拉列表的选定值,那么..



If you mean the selected value of dropdownlist then..

YourDropDown.selectedValue





如果你的意思是选定的文字..





If you mean the selected text..

YourDropDown.SelectedItem.Text