C# 从代码隐藏中的下拉列表中获取选定值

C# 从代码隐藏中的下拉列表中获取选定值,c#,javascript,drop-down-menu,code-behind,C#,Javascript,Drop Down Menu,Code Behind,我有下面的下拉列表,使用javascript获取所选值非常简单 <select id="FirstDropDown" runat="server" onchange="ValidatePrimaryDropDown();" > <option>[Please Select Yes Or No]</option> <option>Yes</option>

我有下面的下拉列表,使用javascript获取所选值非常简单

<select id="FirstDropDown" runat="server" onchange="ValidatePrimaryDropDown();" > 
                    <option>[Please Select Yes Or No]</option>
                    <option>Yes</option>
                    <option>No</option>
                </select>

var e = document.getElementById("FirstDropDown");
var dropDownFirst = e.options[e.selectedIndex].value;

[请选择是或否]
对
不
var e=document.getElementById(“第一个下拉列表”);
var dropDownFirst=e.options[e.selectedIndex].value;
我更喜欢使用此下拉列表作为
'asp:DropDownList'
的对应项


如何在C#后面的代码中检索所选值?

这是aspx页面吗?如果是,请将名称属性添加到您的选择和使用中

Requets.Form["elementName"];
在aspx.cs中

顺便说一句:对于您的javascript代码:您使用DOM选择而不是jquery有什么特别的原因吗?在jquery中,您只需使用

var selectedItem = $("#FirstDropDown").find(":selected").text()

有FindByText和FindByValue函数可用

ListItem li = Select1.Items.FindByText("Three");
ListItem li = Select1.Items.FindByValue("3");
li.Selected = true;

展示一些代码员。但无论如何,如果它是runat=“server”,那么您应该有一些智能感知。你觉得什么东西最有用?