Solved

call master page control

Posted on 2007-11-16
6
2,569 Views
Last Modified: 2008-02-01
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?
0
Comment
Question by:caoimhincryan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 11

Accepted Solution

by:
cmhunty earned 250 total points
ID: 20297439
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
0
 
LVL 12

Expert Comment

by:needo_jee
ID: 20297446
in  Links.aspx

 MasterPage ms = (MasterPage)Master;
        Panel pp = (Panel)ms.FindControl("Panel1");
        pp.Visible = true;
0
 
LVL 12

Assisted Solution

by:needo_jee
needo_jee earned 250 total points
ID: 20297456
if want to short the code then this line
((Panel)((MasterPage)Master).FindControl("Panel1")).Visible = true;

VB.Net
Ctype(Ctype(Master,MasterPage).FindControl("Panel1"),Panel).Visible =True
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:caoimhincryan
ID: 20297638
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)
        MyBase.OnError(e)

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

       Response.Write(Server.GetLastError().Message)

        Server.ClearError()
       

    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?
0
 

Author Comment

by:caoimhincryan
ID: 20297645
I never specified that my error message is in my panel on the master page hence why I want it to display.
0
 

Author Comment

by:caoimhincryan
ID: 20298538
I split the points. I feel I need to ask a new question for my current issue.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question