0
ajax 호출을 사용하여 반환 된 데이터로 바인드하려는 jquery 데이터 가능 UI가 있습니다. 표시하려는보기는 부분보기를 사용합니다. 제 컨트롤러에서 json 타입을 반환합니다.ajax 호출에서 데이터를 가져올 수 있지만 IE는 데이터를 jquery 데이터 테이블 UI로 바인딩하는 대신 다운로드합니다.ajax가 jquery 데이터 테이블 플러그인과 바인딩하지 않았습니다.
기본보기와 부분보기 모두에서 jquery 스크립트를 추가하려고했지만 아무 것도 작동하지 않았습니다. 내가 가진
<div class="col-md-12">
<h4>Search Results</h4>
</div>
<div class="col-md-12">
<table id="searchResults" class="display" cellspacing="0" width="100%">
<thead>
<tr>
@*<th> Select</th>*@
<th>Username</th>
<th>Email</th>
<th>First Name</th>
<th>MI</th>
<th>Last Name</th>
<th>Address</th>
<th>City</th>
<th>State</th>
<th>Zip</th>
<th>Phone</th>
<th></th>
@*<th>CE Type</th>*@
</tr>
</thead>
<tbody>
@{
for (var i=0; i < Model.SearchRecords.Count; i++)
{
<tr>
<td>
@*@Html.CheckBox("Select")*@
@Model.SearchRecords[i].UserName
@Html.HiddenFor(modelItem => Model.SearchRecords[i].CountryID)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].CountryCode)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].PersonID)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].Email)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].FirstName)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].MiddleName)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].LastName)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].Address)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].City)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].UserName)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].PostalCode)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].Phone)
@*@Html.HiddenFor(modelItem => Model.SearchRecords[i].ACPEID)
@Html.HiddenFor(modelItem => Model.SearchRecords[i].AAVSBID)*@
@*@Html.HiddenFor(modelItem => Model.SearchRecords[i].CH)*@
@*@Html.HiddenFor(modelItem => Model.SearchRecords[i].PhysicianTypeID)*@
</td>
<td>@Model.SearchRecords[i].Email</td>
<td>@Model.SearchRecords[i].FirstName</td>
<td>@Model.SearchRecords[i].MiddleName</td>
<td>@Model.SearchRecords[i].LastName</td>
<td>@Model.SearchRecords[i].Address</td>
<td>@Model.SearchRecords[i].City</td>
<td>@Model.SearchRecords[i].StateCode</td>
<td>@Model.SearchRecords[i].PostalCode</td>
@if (Model.SearchRecords[i].Phone != "INVALID")
{
<td>@Model.SearchRecords[i].Phone</td>
}
@if (Model.SearchRecords[i].Phone == "INVALID")
{
<td> <text></text></td>
}
<td>
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-expanded="true">
Manage
</button>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu1">
<li role="presentation"><a role="menuitem" tabindex="-1" href="@Url.Action("ViewProfile1", "Learner", new { personid=Model.SearchRecords[i].PersonID})">View Profile</a></li>
</ul>
</div>
</td>
</tr>
}
}
</tbody>
</table>
</div>
예제가 내 작품처럼 작동합니다. json 결과는 jquery DataTable이 아닌 raw로 표시됩니다. 그것을 확인하십시오 : [링크] (http://imgur.com/g4bFVep) – CoFran
@CoFran :이 코드는 작동합니다. vs2012 및 MVC4에서 샘플 프로젝트를 작업하고 있습니다. 제 경우에는 데이터 테이블에 행으로 표시됩니다 (현재 컨트롤러에서 하나의 사용자 세부 정보 만 반환하고 있음). –