Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • TechnoMan 11 posts 51 karma points
    Aug 26, 2011 @ 01:02
    TechnoMan
    0

    Run UserControl Macro on specific pages

    Hi guys,

    My logic is very simple. All I want is Display a .net usercontrol macro on basis of the current page. To apply this condition I need to use an xslt Macro. Following is my code.

     

    this goes in the Template-->>

    <umbraco:Macro Alias="RegisterProjectsDiv" runat="server"></umbraco:Macro>

    this goes in the xslt-->>RegisterProjectsDiv.xslt

    <xsl:output method="xml" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>

    <xsl:variable name="eventsMacro" select="string('&lt;?UMBRACO_MACRO
        macroAlias=&quot;RegisterInterestForm&quot; numberOfItems=&quot;2&quot;
        eventStartPage=&quot;1506&quot;&gt;&lt;/?UMBRACO_MACRO&gt;')"/>    
        
    <xsl:template match="/">
    <xsl:if test="$currentPage/ancestor::*[@id = 1136]">
      <div class="roundedpanel">
        <a href="{umbraco.library:NiceUrl(1188)}">Register For Project of Interest</a>
        <xsl:value-of select="umbraco.library:RenderMacroContent($eventsMacro, number($currentPage/@id))" disable-output-escaping="yes"/>
      </div>
    </xsl:if>
    </xsl:template>

    The problem is, the usercontrol form is just rendered but not functioning. How do i get it to fire the page events/functions? Can any one suggest me a different logic I should apply here or is possible to use what is in xslt in the usercontrol as well?

     

    Thanks

    TechoMan

  • Rich Green 2246 posts 4006 karma points
    Aug 26, 2011 @ 01:41
    Rich Green
    0

    Hey TechoMan,

    Welcome to the fourm!

    You can use the solution at the bottom of this post

    http://our.umbraco.org/forum/templating/templates-and-document-types/15707-if-statement-on-masterpage?p=0#comment57895

    Regards

    Rich

  • TechnoMan 11 posts 51 karma points
    Aug 26, 2011 @ 01:48
    TechnoMan
    0

    Thanks Rich,

     

    I will try now and reply.

     

  • TechnoMan 11 posts 51 karma points
    Aug 26, 2011 @ 03:40
    TechnoMan
    0

    Works Perfectly! Thanks Rich!

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies