This is a migrated thread and some comments may be shown as answers.

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

1 Answer 664 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
DH
Top achievements
Rank 1
DH asked on 25 Mar 2014, 07:40 PM
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?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 26 Mar 2014, 06:43 AM
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:TextBox>
</asp:Panel>
<asp:Label ID="Label1" runat="server" Text="demo">
</asp:Label>

Master Page C#:
public Panel pnlDemo
{
    get
    {
        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;
    }
}

Thanks,
Shinu.
Tags
Ajax
Asked by
DH
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or