こんにちはMVCアプリケーションに問題があります。ActionLink>サーバーからデータをロード>をクリックし、同じページのdivにデータを挿入したいと思います。しかし、私のコードはまだ新しいページにコンテンツをロードしていて、その理由がわかりません。私を助けてくれる人はいますか?
これはHomeControllerの私のIndex.cshtmlです。
@model IEnumerable<Kango_kmen.KangoKmenWS.WSEntityInfo>
@Content.Script("jquery-1.9.1.min.js", Url)
@Content.Script("jquery.unobtrusive-ajax.min.js",Url)
@Content.Script("jquery.unobtrusive-ajax.js",Url)
@Content.Script("myScript.js",Url)
@section Entities{
<table>
<tr>
<th>
<input type="submit" value="zobrazit" />
</th>
<th>
iD
</th>
<th>
name
</th>
</tr>
@foreach (var item in Model) {
<tr>
<td>
@Ajax.ActionLink("..", "CheckEntity", new { id = item.iD },
new AjaxOptions{ UpdateTargetId="properties",
HttpMethod="GET",
InsertionMode=InsertionMode.InsertAfter,
})
</td>
<td>
@Html.DisplayFor(modelItem => item.iD)
</td>
<td>
@Html.DisplayFor(modelItem => item.name)
</td>
</tr>
<tr>
<td>
<div id="properties">
</div>
</td>
</tr>
}
</table>
}
@section PropertyInfo{
<p>Property info</p>
}
@section Properties{
<p>properties</p>
}
そしてこれがHomeControllerの私のコントローラーです
public PartialViewResult CheckEntity(int id)
{
var model = WSConnect.getEntityInfo(id);
if(model !=null){
return PartialView("CheckEntity", model.property);
}
var modell = new WSEntityInfo[0];
return PartialView("CheckEntity", modell);
}
ChecktEntityは部分ビューですが、ActionLinkコントローラーのロードURLをクリックするたびに、この新しいページのビューデータの例として/ Home / ChceckEntity / 1000 "(