call master page control

I have my master page control with a panel1 in it. Its property visible is set to false.

In one of my pages for example- Links.aspx I want to set the panel1 property visible = true in my master page.

Is this possible?
Who is Participating?
cmhuntyConnect With a Mentor Commented:
You can access the controls in the master page using me.Form.Parent.FindControl..........

So you'd have something like:

CType(me.Form.Parent.FindControl("panel1"),Panel).Visible = True
Munawar HussainPrincipal Software EngineerCommented:
in  Links.aspx

 MasterPage ms = (MasterPage)Master;
        Panel pp = (Panel)ms.FindControl("Panel1");
        pp.Visible = true;
Munawar HussainConnect With a Mentor Principal Software EngineerCommented:
if want to short the code then this line
((Panel)((MasterPage)Master).FindControl("Panel1")).Visible = true;

Ctype(Ctype(Master,MasterPage).FindControl("Panel1"),Panel).Visible =True
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

caoimhincryanAuthor Commented:
Thanks for the quick response. Both work great but actually doesnt display for the context Im using it. Let me explain.

I have my panel in master page. Then on my links page i override the onError method so as to display my own error message.

Protected Overrides Sub OnError(ByVal e As System.EventArgs)

        '    'do stuff here
        UpdatePanel1.Visible = False
        CType(Me.Form.Parent.FindControl("ErrorHandlerPanel"), Panel).Visible = True



    End Sub

To test this i have added Throw New ApplicationException("Blahh") on my page load event.

All thats displayed is "Blahh" . Would anyone know how to display my panel?
caoimhincryanAuthor Commented:
I never specified that my error message is in my panel on the master page hence why I want it to display.
caoimhincryanAuthor Commented:
I split the points. I feel I need to ask a new question for my current issue.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.