ASPX templates
Version 7.x > ASPX templates > Custom Macros View modes: 
User avatar
Member
Member
andrewjknox - 12/20/2012 8:30:20 AM
   
Custom Macros
Hi,
I seem to be having problems getting my custom macro to render. I've got substitution macros working no problem, but I'm left with:

{#CUSTOMEXPRESSION#}

on the rendered output for a custom macro I've added into a doc type transformation.

The code is in the same class as the working substitution macro and it's event is registered on app start-up.

The only difference is, my event handler method is never entered when I add a breakpoint in my code and I'm attached to the debugger.

Is there anything else I need to do here?

PS: I renamed the handler method name in case it clashed with the sample one (found that in another post in the forum)

Thanks,
Andrew

User avatar
Member
Member
andrewjknox - 12/21/2012 7:24:56 AM
   
RE:Custom Macros
Managed to figure this one out in the end.

Seems I can't use these expressions in an ASCX type transformation - switched over to text/xml and it's working fine now.

User avatar
Kentico Support
Kentico Support
kentico_janh - 12/21/2012 10:09:41 AM
   
RE:Custom Macros
Hello,

Yes, however you can resolve macros in the ASCX transformation as well, but you need to call them like this:

<%# CMS.CMSHelper.CMSContext.CurrentResolver.ResolveMacros("{#CUSTOMEXPRESSION#}") %>


Best regards,
Jan Hermann