views:

32

answers:

1

Hello SO Community,

I've been using Html.Action("ActionName", "ControllerName") to invoke child actions across controllers without needing to have the view in Views\Shared. This has been working great for displaying things like session or cookie information.

Instead of just accessing cookies, I would like to pass additional parameters to Html.Action("ActionName", "ControllerName") so the action can execute different code based on the the data passed to the original view.

Should I be using a different method to pass parameters to a child action in a different controller? How would one accomplish this?

+3  A: 

You could specify additional data in the RouteValues property like this.

Html.Action("Controller","Name", new { id = 1 })
Roberto Hernandez
Aw Sweet!!! I saw RouteValues in the intelisense but I didn't use that format. I tried `Html.Action("Action", "Controller", model.Paramter)`. I'm gonna try this right away.
quakkels