Copied to clipboard

Flag this post as spam?

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


  • nickornotto 403 posts 907 karma points
    Dec 19, 2012 @ 19:32
    nickornotto
    0

    Code Behind access to lower level master controls

    Hi,

    I have top level master page (Master.master) in my umbraco website and then another master page (Home.master) which inherits the top-level one. Eg.

    In the Home.master I have a control:

    <asp:Content ContentPlaceHolderID="MainContentPlaceHolder" runat="server">

    <umbraco:Item field="box1Title" runat="server" />

    </asp:Content>

    and a reference to the Master.master of course:

    <%@ Master Language="C#" MasterPageFile="~/masterpages/Master.master" AutoEventWireup="true" %>

    I need to access controls of Home.master from Master.master.

    I'm trying:

    umbraco.presentation.templateControls.Item box1Title = (umbraco.presentation.templateControls.Item)MainContentPlaceHolder.FindControl("box1Title");

    but it returns null object

     

    Can anybody spot what I'm doing wrong?

    Thank you for help

Please Sign in or register to post replies

Write your reply to:

Draft