I'm pretty new to Umbraco and need to know the best way of doing something
I have a macro on a template which calls a .ascx file. I currently pass the PageID which I then use in the .ascx file to return a specific phone number for a specific page.
I'd now like to extend this to be able to display a specific phone number on each page that use a specific Template.
I can get the template ID like this: <umbraco:Item runat="server" field="template"/> but I don't know how to pass that value to my macro.
How to pass the template ID to a Macro?
Hi,
I'm pretty new to Umbraco and need to know the best way of doing something
I have a macro on a template which calls a .ascx file. I currently pass the PageID which I then use in the .ascx file to return a specific phone number for a specific page.
I'd now like to extend this to be able to display a specific phone number on each page that use a specific Template.
I can get the template ID like this: <umbraco:Item runat="server" field="template"/> but I don't know how to pass that value to my macro.
This is the macro tag I'm currently using:
<umbraco:Macro PageID="[#pageID]" Alias="ControlName" runat="server"></umbraco:Macro>
Any help would be greatly appreciated.
Thanks
Simon
Hi Simon,
I'm not sure how to achieve just that, but can't you just fetch the current pages template id from within your UserControl? Like this:
? :-)
All the best,
Bo
Hi Bo,
Thanks for your reply.
And thanks for getting me on the right track!
returned an object not set to an instance of an object error. But,
Returned the id of the current template.
Would this be caused by a difference in versions? I'm using 4.5.2.
Thanks again for you help.
Simon
is working on a reply...