controller cs
public ActionResult AdvanceSearchForm()
{
SearchCriteriaModel model = new SearchCriteriaModel { SearchInAll = true };
return PartialView("AdvanceSearchForm", model);
}
用法1 cshtml
@Html.Action("AdvanceSearchForm")
这种访问方式,先会去controller 执行AdvanceSearchForm 这个action ,然后再回到cshtml
用法2 cshtml
@Html.Partial("AdvanceSearchForm",new SearchCriteriaModel { SearchInAll = true })
这种访问方式,不会去controller ,而是直接到cshtml
时间: 2024-10-13 10:45:22