問題は:私はIndex.cshtmlを持っています
@{
ViewBag.Title = "Search";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="@Url.Content("../../Scripts/jquery.unobtrusive-ajax.min.js") type="text/javascript"></script>
<h2>Answer's are </h2>
<div id="result">
@Ajax.ActionLink("Search Wiki",
"WikiAns",
new AjaxOptions{
UpdateTargetId = "result",
InsertionMode=InsertionMode.Replace,
HttpMethod="GET",
LoadingElementId="progress"
})
</div>
<div id="progress" style="display: none">
<img src="@Url.Content("../../Content/Images/ajax-loader.gif")" alt="loader" />
</div>
今、私は部分ビューモデル_WikiAnsを持っています:
@model IEnumerable<Questions.Models.WikiAnsClass>
<h2>Our Links</h2>
<table>
@foreach (var item in Model) {
<tr>
<td>
<a href="@item.url" target="_blank">@item.content</a>
</td>
</tr>
}
</table>
上記を使用して、検索Wikiアクションリンクをクリックすると、 id="result" がレンダリングされたすべての部分ビューを取得します。しかし、それは起こっていません。ページ " localhost:80/Search/WikiAns
" に移動して、そこで結果を表示する代わりに。localhost:80/Search
しかし、私はそれをそのままにして、その「結果」IDを置き換えたいと思っています。しかし、このようには機能しません。
これが私のアクションですWikiAns
public ActionResult WikiAns()
{
//Code to follow...
var wikians = //code to follow
return PartialView("_wikiAns", wikians);
}
どうしたの ?
また、この Ajax GIF ローダーをどのように実装できますか...アクションが実行されている間にそれを表示することを意味します。?
提案してください
ありがとう