1
如何在用户单击搜索后显示结果时如何构造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操作方法:
public PartialViewResult Search(HarvestFilter filter)
{
return PartialView("Results");
}