我在部分视图页面使用jquery auto complete,就像弹出一样。问题是复杂性没有显示在文本框下而不是它在我的弹出页面下如何解决?这是我的代码
@using (@Html.BeginForm("SaveUserTask", "User", FormMethod.Post, new { id = "frmTask" }))
{
@Html.ValidationSummary(true)
@Html.HiddenFor(model => model.ID)
<label for="search">Search</label>
<input id="autocomplete" title="type "a"" name="autocomplete" style="height: 20px; width: 300px;"/>
}
<link href="~/Styles/jquery-ui-themes-1.10.0/themes/base/jquery.ui.autocomplete.css" rel="stylesheet" />
<script src="jquery/jquery.js"type="text/javascript" ></script>
<script src="jquery-ui.js" type="text/javascript" ></script>
$("#autocomplete").autocomplete({
source: '@Url.Action("GetuserNames")'
});
public JsonResult GetuserNames(string term)
{
var db = new eEntities();
var userNames = db.User.Where(s => s.UserName.StartsWith(term)).Select(s => s.UserName).ToList();
return Json(userNames, JsonRequestBehavior.AllowGet);
}