Hide\Show Panel in master page from content page with strongly typed controls.

2 posts, 0 answers
  1. DH
    DH avatar
    11 posts
    Member since:
    Dec 2011

    Posted 25 Mar 2014 Link to this post

    I'm having an issue updating content on a master page, using strongly typed controls. 

    On my master page, i have public classes that expose the .visible property of an asp.net panel, the content page sets the param to true or false. I have a radajaxmanager on master page and proxy on sub page, however I am unable to ajaxify the panels on the master.

    For the solution I would prefer not to use FindControl()

    Can someone point me in the correct direction?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 26 Mar 2014 in reply to DH Link to this post

    Hi Dan,

    For accessing the Master Page control in Content Page you have to define some public properties in the master page as follows.

    Master Page ASPX:
    <asp:Panel ID="Panel1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server">
    <asp:Label ID="Label1" runat="server" Text="demo">

    Master Page C#:
    public Panel pnlDemo
            return Panel1;

    Thus in the content page try the following code snippet to access the control.

    Content Page C#:
    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            //RadAjax_PanelAjax is the class name of the master page
            RadAjax_PanelAjax master = Page.Master as RadAjax_PanelAjax;
            master.pnlDemo.Visible = false;

Back to Top