passing parameters from a webform to a particial view macro
Hi,
i recently upgraded a site from v4.5 to the v6.1.6. The creator used mainly webforms for templates. I am currently editing some of the fuctionality via partial views macros. I need to pass parameters to the PVM.
How do I access the parameters in the macro script?
Usually from docs or forum, there is little info that clearly deals with the partial views macros context, from what i understand is different from razor macros and partial views. I do hope this helps other persons getting started, like me, but have to work with PVMs (partial views macros).
There is some documentation on Partial View Macro's here We do however need some more documentation on UmbracoHelper and IPublishedContent here, I'm sure it will happen soon(ish). Meanwhile I'm sure your questions will get answered on the forum!
Macro parameters, should be added first in the macro settings in the CMS, or you can add a paramter on the fly which is not added to the macro from the CMS?
Since I would like to pass a dynamic parameter which is the viewbag, to the macro partial view.
passing parameters from a webform to a particial view macro
Hi,
i recently upgraded a site from v4.5 to the v6.1.6. The creator used mainly webforms for templates. I am currently editing some of the fuctionality via partial views macros. I need to pass parameters to the PVM.
How do I access the parameters in the macro script?
Hi Stan,
If you´re using Razor macro scripts you can get the value of a parameter by using this.
And here you find the documentation for this: http://our.umbraco.org/documentation/reference/templating/macros/razor/using-macro-parameters
Hope this helps,
/Dennis
Hi Stan,
You access the Macro Parameters like this in a partial view macro:
This will return a object so you might need to convert it, e.g:
Jeavon
Hi,
Thanks Guys! Dennis and Jeavon, would i need to include any additional namespaces in my macros? eg:
@using umbraco.MacroEngines
thanks again.
Hi Stan,
No, a very very simple complete partial view macro would only be:
Jeavon
You are a Boss! thanks!
Usually from docs or forum, there is little info that clearly deals with the partial views macros context, from what i understand is different from razor macros and partial views. I do hope this helps other persons getting started, like me, but have to work with PVMs (partial views macros).
Cheers!
You're welcome!
There is some documentation on Partial View Macro's here We do however need some more documentation on UmbracoHelper and IPublishedContent here, I'm sure it will happen soon(ish). Meanwhile I'm sure your questions will get answered on the forum!
Jeavon
Hi Jeavon,
Macro parameters, should be added first in the macro settings in the CMS, or you can add a paramter on the fly which is not added to the macro from the CMS?
Since I would like to pass a dynamic parameter which is the viewbag, to the macro partial view.
Thank you.
Kind Regards.
is working on a reply...