+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Hide elements on masterpage

Hide elements on masterpage

2 posts, 0 answered
  1. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    12 Dec 2010
    Link to this post
    Hi,

    I have a generic content view which obviously has a singleitemview and a listingview.

    These views require very different layouts on the page, therefore I have done the following within my master page.

    <div class="container containerFullWidth">
        <div id="contentLeft">
            <asp:ContentPlaceHolder ID="cphSubNav" runat="server" />
            <asp:ContentPlaceHolder ID="cphContentPanel1" runat="server" />
        </div>
     
        <asp:Panel ID="pnlMemberListing" runat="server">
            <div id="contentMid">
                <asp:ContentPlaceHolder ID="cphContentPanel2" runat="server" />
            </div>
            <div id="contentRight">
                <asp:ContentPlaceHolder ID="cphContentPanel3" runat="server" />
            </div>
        </asp:Panel>
     
        <asp:Panel ID="pnlMemberProfile" runat="server">
            <%--The MemberProfile user control already has the divs for contentMid and contentRight--%>
            <asp:ContentPlaceHolder ID="cphContentPanel4" runat="server" />
        </asp:Panel>
     
    </div>

    There are two panels, within these panels are contentplaceholders. My contentview will be placed in both the cphContentPanel2 and cphContentPanel4 content place holders.

    When my contentview loads, I need to be able to set the "visible" property of one of the panels. i.e.

    From within

    protected override void CreateContentList() {}

    I need to be able to hide the panel pnlMemberProfile.

    From within 

    protected override void CreateSingleContent() {

    I need to be able to hide the panel pnlMemberListing.

    Can this be done?

    Thanks
    higgsy
  2. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    12 Dec 2010
    Link to this post
    Please ignore this post...it was easy...

    //hide the listing view
                var oPanel = this.Parent.Page.Master.FindControl("pnlMemberListing") as Panel;
                if (oPanel is Panel) {
     
                    ((Panel)oPanel).Visible = false;
                }

2 posts, 0 answered