简体   繁体   English

asp.net剃刀将自动完成值添加到html文本框

[英]asp.net razor adding autocomplete value to html text box

I have a subject box in razor form which adds default wording too. 我有一个剃刀形式的主题框,它也添加了默认的措辞。 But I want to add what the user picks in the drop down box. 但是我想在下拉框中添加用户选择的内容。 the drop down box id is CustomFieldValue8. 下拉框ID为CustomFieldValue8。 How would i do this ? 我该怎么办? I am new to razor. 我是剃刀新手。 This is an autocomplete textbox if that matters, Jquery. 如果需要的话,这是一个自动完成的文本框,jQuery。

<td colspan="2">



        @LangStrings.Subject<br />
        @Html.TextBoxFor(model => model.Subject, new { @Value = "Specification Change Request", @style = "width:30%" })
        @Html.ValidationMessageFor(model => model.Subject)
    </td>

I hope these pages could help: 我希望这些页面可以帮助您:

http://jqueryextensions.codeplex.com/ http://jqueryextensions.codeplex.com/

http://mvcautocomplete.codeplex.com/ http://mvcautocomplete.codeplex.com/

http://blogs.msdn.com/b/miah/archive/2008/11/13/autocompletion-textbox-in-mvc-using-jquery.aspx http://blogs.msdn.com/b/miah/archive/2008/11/13/autocompletion-textbox-in-mvc-using-jquery.aspx

http://carlhoerberg.com/how-to-use-jquery-ui-autocomplete-with-aspnet http://carlhoerberg.com/how-to-use-jquery-ui-autocomplete-with-aspnet

http://autocompletedotnet.codeplex.com/documentation#Asp.Net%20MVC http://autocompletedotnet.codeplex.com/documentation#Asp.Net%20MVC

For example if you use the last autocomplete, and download the dll, you could use the autocomplete simply in your view like this: 例如,如果您使用最后一个自动完成功能并下载dll,则可以在视图中简单地使用自动完成功能,如下所示:

@Html.AutoCompleteTextBox("country", 
                 new Uri("/Countries/SearchByFirstLetters", UriKind.RelativeOrAbsolute), 
                 "Name")

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

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