繁体   English   中英

Kendo TabStrip:在MVC 4中将父模型传递给ChildAction

[英]Kendo TabStrip: Passing the Parent Model to the ChildAction in MVC 4

我在MVC 4中定义了Kendo UI标签栏:

@model SearchUserModel

@(Html.Kendo().TabStrip()
  .Name("tabMain")
  .Items(items =>
      {
          items.Add()
               .Text("Search")
               .Content(Html.Action("Form","SearchUser").ToString()).Selected(true);
          items.Add()
               .Text("Manage User")
               .Action("Index", "ManageUser");

      })
  .Animation(false)
  )

ChildAction“表单”与此父级位于同一控制器“ SearchUser”上。

问题:如何将父级的SearchUserModel传递给“ Form” /“ SearchUser” ChildAction

您应该能够使用Html.Action()帮助器的routeValues参数传递模型,如下所示:

Html.Action("Form", "SearchUser", new { model = Model })

然后,您只需要修改控制器操作即可接受模型作为参数:

public ActionResult Form (SearchUserModel model)
{
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM