What version of Umbraco are you using? In Umbraco 5 you would need to inherit from the PartialView class, which means you need to have the following in the top of your view: @inherits PartialViewMacroPage
Then you can fetch the parameters using this
var param = model.MacroParameters.paramalias
Then you can call the param variable where you need it in your view.
Please note that the model referenced above is the model of the macro, not Umbraco itself.
What you would typically have is the following: in your template, you have a call to your macro, so something like this, where you declare your parameters as attributes of the macro:
How can implement .net user control with parameters into cshtml ?
How i can load macro / .net user control with parameters from cshtml ?
Render func, only put html on the page but serverside not working..
Help..
Hi Nonacc
What version of Umbraco are you using? In Umbraco 5 you would need to inherit from the PartialView class, which means you need to have the following in the top of your view: @inherits PartialViewMacroPage
Then you can fetch the parameters using this
var param = model.MacroParameters.paramalias
Then you can call the param variable where you need it in your view.
Please note that the model referenced above is the model of the macro, not Umbraco itself.
Hope this helps.
/Jan
Hey Jan,
I'm using umbraco v 4.7.0 (Assembly version: 1.0.4090.21631).
Can you show me example of your explanation?
I got website with one search engine macro and two languages, each time i change the language i need to pass different int parameter (pageId).
Hi Nonacc,
What you would typically have is the following: in your template, you have a call to your macro, so something like this, where you declare your parameters as attributes of the macro:
Then, in your macro, you would have something like this:
Hope this helps
Cheers,
Michael.
is working on a reply...