【发布时间】:2012-06-28 07:19:42
【问题描述】:
我的查询是,我的表单中有一个 html 组合框,我想将组合框的选定项的值传递给服务器端,它是一个 aspx 页面,
<form method="POST" action="page.aspx">
<input id="customerName" name="customerName" type="Text" />
<input id="customerPhone" name="customerPhone" type="Text" />
<select id="combobox" >
<option>df</option>
<option>as</option>
</select>
<input
</form>
value="Save" type="Submit" />
在服务器端,我使用以下代码集来选择文本框值
string n = String.Format("{0}", Request.Form['customerName']);
但是如何获取组合框选中值的值 请帮我 提前谢谢
【问题讨论】:
-
请检查您将获得 selectedValue Request.Form['customerName']
-
你的选择元素需要一个名字; Request.Form 与 name 属性无关。添加一个名称,如 name="MyComboBox",然后 Request.Form["MyComboBox"] 应该为您提供值。出于兴趣,为什么不使用
标签: c# javascript asp.net html