简体   繁体   English

asp.mvc可编辑下拉列表框(组合框)

[英]asp.mvc editable dropdownlist box (combobox)

I am looking for a solution to an issue I have with a current MVC 4 project I am working on. 我正在寻找解决方案,以解决当前正在处理的MVC 4项目中的问题。 I would like to have an editable dropdownlist control, or combobox as I think this type of control is sometimes called. 我想拥有一个可编辑的下拉列表控件或组合框,因为我认为有时会调用这种类型的控件。 Where the control would operate as a typical dropdown control, but allow the user to type in a value that is not present in the dropdown list. 该控件将用作典型的下拉控件,但允许用户键入下拉列表中不存在的值。 I have had no luck with my search so far so I am hoping that this great community of developers could point me in the right direction. 到目前为止,我的搜索工作并不顺利,因此我希望这个伟大的开发人员社区可以为我指明正确的方向。 Thanks! 谢谢!

If you use HTML then you can use input with datalist attribute Example: 如果使用HTML,则可以将输入datalist属性一起使用示例:

<input type="text" name="fieldName" list="valueList"/>
<datalist id="valueList">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
</datalist>

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

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