Solved

call master page control

Posted on 2007-11-16
6
2,566 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 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