获取 HTML Select 下拉列表的选定值
Get selected value of HTML Select dropdown
获取 HTML Select
元素的选定值的最佳方法是什么?我知道 ASP.net 我可以做这样的事情:
<select id="myDrpDown" name="myDrpDown" class="form-control" multiple="multiple"></select>
C#
myDrpDown.SelectedValue
我可以使用这个来拉取选定的文本:
Request.Form["myDrpDown"];
有什么建议吗?
myvalue = myDrpDown.SelectedText;
或者,
myvalue = myDrpDown.DataSource[myDrpDown.SelectedIndex][myDrpDown.DataTextField].ToString();
how to get selected text from html select in asp.net code-behind?
获取 HTML Select
元素的选定值的最佳方法是什么?我知道 ASP.net 我可以做这样的事情:
<select id="myDrpDown" name="myDrpDown" class="form-control" multiple="multiple"></select>
C#
myDrpDown.SelectedValue
我可以使用这个来拉取选定的文本:
Request.Form["myDrpDown"];
有什么建议吗?
myvalue = myDrpDown.SelectedText;
或者,
myvalue = myDrpDown.DataSource[myDrpDown.SelectedIndex][myDrpDown.DataTextField].ToString();
how to get selected text from html select in asp.net code-behind?