我似乎无法从视图中获取模型以使用DevExpress按钮的路由值传递回控制器动作。这是按钮:
Html.DevExpress().Button(btn =>
{
btn.Name = "btnSubmit";
btn.Text = "Search";
btn.Width = Unit.Pixel(100);
btn.UseSubmitBehavior = true;
btn.RouteValues = new {Controller = "ProjectSearch", Action = "PerformSearch", projectSearchParametersModel = Model};
}).Render();
然后我要执行此控制器操作:
public ActionResult PerformSearch(IProjectSearchParametersModel projectSearchParametersModel)
{ /* do search */ }
不幸的是,每次我执行该操作时projectSearchParametersModel都为null,我无法弄清楚为什么该模型无法通过。
答案 0 :(得分:0)
使用:
@using (Html.BeginForm(FormMethod.Post))
示例:
@using (Html.BeginForm(FormMethod.Post))
{
Html.DevExpress().Button(btn =>
{
btn.Name = "btnSubmit";
btn.Text = "Search";
btn.Width = Unit.Pixel(100);
btn.UseSubmitBehavior = true;
btn.RouteValues = new {Controller = "ProjectSearch", Action = "PerformSearch"};
}).Render();
}