is it possible to load an XSLT macro from a .net CONTROL?
I have a situation where there is a page with about 6 components on it. 4 of these 6 can be done with XSLT. the other 2 need to be .NET. Whats the best way to go about doing this? i can always just load 6 individual macros from the template itself, is that advisable?
using umbraco.presentation.templateControls; // need this for Item
Item macro = new Item
{
NodeId = myNode.Id.ToString(), // then node id of node containg the macro
Field = "macro" // the property field of the macro
};
if (macro != null)
myPlaceHolder.Controls.Add(macro); // add the item to a placeholder
I have stripped away some code, but this should do it, eventually you want to check if more things exists and some other error checks.
But we also load lots of indiviudal macros in each template and that should not be a problem.
load an XSLT macro from a .NET control
hi all,
is it possible to load an XSLT macro from a .net CONTROL?
I have a situation where there is a page with about 6 components on it. 4 of these 6 can be done with XSLT. the other 2 need to be .NET. Whats the best way to go about doing this? i can always just load 6 individual macros from the template itself, is that advisable?
Thanks,
Tilly
Hi, am not sure if this is what you want to do, but this code I use to load a macro in .NET.
The Macro we load is on a Document Type, and use the macro picker datatype (http://our.umbraco.org/projects/backoffice-extensions/macropicker)
I have stripped away some code, but this should do it, eventually you want to check if more things exists and some other error checks.
But we also load lots of indiviudal macros in each template and that should not be a problem.
Macros are standard ASP.NET server controls, so you can add and remove them programmatically.
Setting the appropriate alias will indicate what one you want to load and where.
is working on a reply...