Passing Parameters From Partial View Macro to Partial View
I have a macro created for Contact Form to allow content contributors to add content before and after the contact form. Inside the PartialViewMacro I call the actual PartialView.
The contact form has a reason dropdown I want to manage the options as media items. I have a macro parameter to allow selection of multiple media items and now I need to figure out how to pass a collection (hashtable, something) of text/value options to the Partial I derive from the media items.
@inherits Umbraco.Web.Mvc.UmbracoViewPage<IPublishedContent>
@{
var param1 = (string)ViewData["param1"];
var param2 = (bool)ViewData["param2"];
}
This partial view is strongly typed and is passing the current page as the Model, so you can access properites like this: Model.GetPropertyValue<string>("myprop")
Passing Parameters From Partial View Macro to Partial View
I have a macro created for Contact Form to allow content contributors to add content before and after the contact form. Inside the PartialViewMacro I call the actual PartialView.
The contact form has a reason dropdown I want to manage the options as media items. I have a macro parameter to allow selection of multiple media items and now I need to figure out how to pass a collection (hashtable, something) of text/value options to the Partial I derive from the media items.
Hi Jon,
You can pass parameters like this:
Partial View Macro
Partial View
This partial view is strongly typed and is passing the current page as the Model, so you can access properites like this:
Model.GetPropertyValue<string>("myprop")
Hope that's helpful?
Jeavon
Thanks, is there a way to perform the same with Html.Action in the MacroView?
You can pass parameters into your controller actions as shown here
is working on a reply...