I need to pass macro's parameters to usercontrol. I have created an usercontrol and import it as macro. In umbraco backoffice, I have created a parameter as string.
In which way I can read this parameter in my usercontrol?
Hi. Your macro parameter simply maps to a public property of your user control. It's a bit more convenient to start from adding a property to the control since umbraco has a feature of determining such properties and offers to add corresponding macro parameters automatically.
No, you don't have to do anything special for razor scripts since all parameters declared in a macro are automatically available through the Parameter property of the DynamicNodeContext class which a macro script itself inherits (the Parameter property returns a dynamic object, so you need to call its properties by name like "Parameter.YourParameterName").
hi ,
I have added a .net user control in umbraco when i trying read that macro in RTE in content page , it show those values in content Editor after publishing it is not showing on site. can please suggest it.
Use parameters of macro with usercontrol
Hi All,
I need to pass macro's parameters to usercontrol. I have created an usercontrol and import it as macro. In umbraco backoffice, I have created a parameter as string.
In which way I can read this parameter in my usercontrol?
Thanks
Hi. Your macro parameter simply maps to a public property of your user control. It's a bit more convenient to start from adding a property to the control since umbraco has a feature of determining such properties and offers to add corresponding macro parameters automatically.
Thanks Rodion, now it's clear!
If I want do the same with razor scripts, in which way I can declare properties into razor code?
No, you don't have to do anything special for razor scripts since all parameters declared in a macro are automatically available through the Parameter property of the DynamicNodeContext class which a macro script itself inherits (the Parameter property returns a dynamic object, so you need to call its properties by name like "Parameter.YourParameterName").
Thanks a lot for the support! Have a nice day
hi , I have added a .net user control in umbraco when i trying read that macro in RTE in content page , it show those values in content Editor after publishing it is not showing on site. can please suggest it.
thanks in advance
Thanks Rodion !!
I was stuck whole day to getting parameters inside user controls
is working on a reply...