简体   繁体   中英

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

I have a Kendo UI Tab Strip in MVC 4 defined:

@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)
  )

The ChildAction "Form" is on the same Controller "SearchUser" as this parent.

Question: How do I pass the parent's SearchUserModel to the "Form"/"SearchUser" ChildAction ?

You should be able to pass the model using the routeValues parameter of the Html.Action() helper like this:

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

Then you just need to modify your controller action to accept the model as a parameter:

public ActionResult Form (SearchUserModel model)
{
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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