Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I would like to call an XSLT macro inside c# and save the result into a string.
Any idea on this?
Thank
Ali
I have also tested following code , but didnt work.
string temp = umbraco.library.RenderMacroContent("<umbraco:Macro pId=\"" + myNode.Id + "\" Alias=\"Get_Items_1st_Level\" runat=\"server\"></umbraco:Macro>", myNode.Id);
When doing it from C# you should probably try using the macro class (umbraco.macro) instead of the umbraco.library.
I haven't tried it myself, but take a look, it has a bunch of methods, one of them might be the one you're looking for!
thanks Steen for your reply. I had a look but couldn't figure out.
is there any documentation for it as I couldn't find any.
Cheers
Hi, umbraco library RenderMacroContent use old macro syntax, so this should work better:
See http://en.wikibooks.org/wiki/Umbraco/Reference/umbraco.library/RenderMacroContent
HTH / Jonas
(Still is that syntax in 4.5.2)
You are legend Jonas.
Thanks a lot mate , it works like a charm.
:-) Cheers!
@jonas
After + 6 hours of struggling with this and trying may ways including the
umbraco.presentation.templateControls.Macro
Thanks Jonas - ur a star
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
how to call a macro within c# ?
I would like to call an XSLT macro inside c# and save the result into a string.
Any idea on this?
Thank
Ali
I have also tested following code , but didnt work.
When doing it from C# you should probably try using the macro class (umbraco.macro) instead of the umbraco.library.
I haven't tried it myself, but take a look, it has a bunch of methods, one of them might be the one you're looking for!
thanks Steen for your reply. I had a look but couldn't figure out.
is there any documentation for it as I couldn't find any.
Cheers
Ali
Hi, umbraco library RenderMacroContent use old macro syntax, so this should work better:
See http://en.wikibooks.org/wiki/Umbraco/Reference/umbraco.library/RenderMacroContent
HTH / Jonas
(Still is that syntax in 4.5.2)
You are legend Jonas.
Thanks a lot mate , it works like a charm.
Cheers
Ali
:-) Cheers!
@jonas
After + 6 hours of struggling with this and trying may ways including the
umbraco.presentation.templateControls.Macro
Thanks Jonas - ur a star
is working on a reply...