Copied to clipboard

Flag this post as spam?

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


  • munyung 6 posts 26 karma points
    Mar 05, 2012 @ 18:09
    munyung
    0

    Master.FindControl returns null on everything when wrapped with ContentPlaceHolderDefault

    First time umbraco dev here.

    i'm trying to set a class on my body element thats found on the first master page.

    How i have it set up right now is

    page.master -> landing.master -> content.master

    based on what the content type is, the body's class attribute has to be changed. 

    so i'v made a recursive method to find the correct master page for me(in this case, page.master) and change the class for the body element. everything works fine.

    and then i wrap it with

    asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server"

    in the @master directive, i have MasterPageFile="~/umbraco/masterpages/default.master"

    then the FindControl method returns null on everything.

    i cannot for the life of me figure out whats wrong.

    another side effect of the wrap is that i lose all my intellisense for the asp and umbraco namespace.

  • munyung 6 posts 26 karma points
    Mar 06, 2012 @ 10:19
    munyung
    0

    anyone?

  • Asif Malik 203 posts 339 karma points
    Mar 06, 2012 @ 14:43
    Asif Malik
    1

    Not sure if this helps but most of the time i add a class to my body tag dependant on what the DocuemntType is (i normally add the actual DocumentType name to the body's class attribute) ... and i use a simple XSLT to provide the data

    <body class="<umbraco:Macro Alias='CssBodyClass' runat='server'></umbraco:Macro>">
    

    and then the XSLT is simply ... you can off course add extar logic here if need be

      <xsl:template match="/">
        <xsl:value-of select="name($currentPage)"/>
      </xsl:template>
    
  • munyung 6 posts 26 karma points
    Mar 06, 2012 @ 17:28
    munyung
    0

    Thanks for that Asif.

    I think the bigger problem here is that the FindControl() method suddenly returns null on everything when i wrap the base master page with the

    "asp:Content ContentPlaceHolderID="ContentPlaceHolderDefault" to allow canvas editing to work.

  • Asif Malik 203 posts 339 karma points
    Mar 06, 2012 @ 17:34
    Asif Malik
    0

    To be honest havent really used Canvas editing, and i activly try to discourage usage of it ... If you really need to work this out, i would suggest getting the Umbraco source code and debugging through the entire thing

  • 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