Nami
Nami

Reputation: 1235

Umbraco Dynamic Macro

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?

Upvotes: 1

Views: 1662

Answers (1)

Tim
Tim

Reputation: 4410

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/

Upvotes: 1

Related Questions