ユーザーが検索をクリックした後に結果を表示したいときにASP.Net MVCページを構成する方法は?結果を返すときにAsp.Net MVCページを構成する方法
私はIndex.cshtmlと呼ばれるビューを持っています。私はフィルタ値と検索ボタンを持つFilter.cshtmlと呼ばれる部分的なビューを持っています。検索ボタンをクリックすると、結果がフィルタ条件の横に表示されます。私の部分的なビューResults.cshtmlがページ全体に表示されます。このタイプのシナリオの正しいページ構造は、フィルタ値と結果を同時に表示するためのものです。
Index.cshml
@{
ViewBag.Title = "Index";
Layout = "~/Views/Shared/_Layout.cshtml";
}
@{ Html.RenderPartial("Filter"); }
@{ Html.RenderPartial("Results"); }
Results.cshtml
<div>This will be the results page that should be displayed next to the filter values</div>
のcontroler対処方法:あなたは、余分な<div />
マークアップを必要としません
public PartialViewResult Search(HarvestFilter filter)
{
return PartialView("Results");
}