1

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 dynamically
    – Mahesh KP
    Commented May 27, 2011 at 4:29

1 Answer 1

1

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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.