Monday, August 5, 2013

Working with Macro Parameter In Umbraco CMS

In your Partial View, if we are passing parameters then to fetch/pass value to parameters we can use following way.

code
:var data = Model.MacroParameters;

description: This will fetch the Macro Parameter associated with our partial view. This line of code are placed in your partial view.

Now, to fetch value of your paremeter value use following line of code
string Name = data.FirstOrDefault(c => c.Key == "ParameterName").Value.ToString(); 

"ParameterName" is the name of your parameter/property which is defined in partial view.

This will fetch value passed to parameter in your partial view and you can use this value to your internal function.                  



No comments:

Post a Comment