Solved

call master page control

Posted on 2007-11-16
6
2,560 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
  • 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now