繁体   English   中英

在服务器端获取组合框的选定值

[英]Getting the selected value of a combo box in server side

我的查询是,我在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']);

但是如何获得组合框所选值的值,请提前帮助我

您可以尝试修复HTML:

<form method="POST" action="page.aspx">
    <input id="customerName" name="customerName" type="text">
    <input id="customerPhone" name="customerPhone" type="text">
    <select id="combobox" name="combobox">
        <option value="df">df</option>
        <option value="as">as</option>
    </select>
    <input value="Save" type="submit">
</form>

所选值将发布为Request.Form['combobox']

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM