1
votes

I have a content type called "FormContentType". This type has a field called "FormAlias". I have number of Macros pointing to UserControl forms. In corresponding templates of contents of "FormContentType" type, I'd like call that Macro based on the value entered in "FormName" field. I want to have some thing like this:

<umbraco:macro alias="[#FormAlias]"  runat="server"/>

Notice that macro alias is dynamic and is based on what is entered in "FormAlias" field of content. But it does not work. If I put the name of one of those form macros explicitly, it works. But using above statement, it does not work. Is this something related to page life cycle?

Could you please help me?

1
i think its very difficult, since macro alias name is given while creating a macro. So giving dynamic alias name to macro in template means we have to change the alias name of macro dynamicallyMahesh KP

1 Answers

1
votes

You will need to create a wrapper macro which loads in the macro dynamically.

See this blog post for details:

http://munkimagik.wordpress.com/2009/04/08/adding-umbraco-macro-dynamically-to-user-control/