안녕하세요 간단한 MVC 자동 완성, 내가 테스트 한 코드 및 "빈"mvc 프로젝트를 만들 때 작동하지만 intenet 응용 프로그램에서 정확한 코드를 수행 할 때 작동하지 않습니다 , 그것은 결코 자동 완성 메서드를 얻을 수 없습니다. 어떤 아이디어? 그래서 유선. 감사합니다ASP.NET MVC 4 자동 완성 작동하지 않습니다.
홈 컨트롤러
static List<Students> _students = new List<Students>() {
new Students{id=1,Name="Bob", Grade="B"},
new Students{id=2,Name="Billy", Grade="A"},
new Students{id=3,Name="Mike", Grade="B"}
};
public ActionResult AutoMethod(string term)
{
//....
}
public ActionResult Index()
{
return View(_students);
}
인덱스보기
@model IEnumerable<MvcApplication1.Models.Students>
<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/jquery-ui-1.10.4.custom.min.js"></script>
<link href="~/Content/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" />
<script type="text/javascript">
$(function() {
$("#searchText").autocomplete({
source: '@Url.Action("AutoMethod")'
});
});
@using (Html.BeginForm()){
@Html.TextBox("searchText");
<input type="submit" value="submit" />
}
<table>
<tr>
<th>
@Html.DisplayNameFor(model => model.Name)
</th>
<th>
@Html.DisplayNameFor(model => model.Grade)
</th>
</tr>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem => item.Name)
</td>
<td>
@Html.DisplayFor(modelItem => item.Grade)
</td>
</tr>
}
: Scripts.Render ("~/번들 @/jquery ") 레이아웃 파일에서 작동합니다. "jquery 번들"에 두 개의 js 파일을 추가하면 작동하지 않습니다. 누군가가 그것을 모두 고치는 방법을 설명 할 수 있습니까? 왜 이러는거야? – Ben