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

人气:603 发布:2022-09-22 标签: html javascript asp.net c# ASP.NET

问题描述

如何在.cs页面中获取HTML下拉列表的选定值 < select>< / select>

推荐答案

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

535