Search EggHeadCafe's Job Board
EggHeadCafe Silverlight WPF ASP.NET VB.NET C# Excel SQL Server SharePoint
search
MicrosoftArticlesForumsFAQs
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml / Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

WebArticlesForumsFAQs
JavaScript
ASP
ASP.NET
WCF

DatabasesArticlesForumsFAQs
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsFAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money

Non-MicrosoftArticlesForumsFAQs
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

Operating SysArticlesForumsFAQs
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsFAQs
BizTalk
Site Server
Exhange Server
IIS

Graphic DesignArticlesForumsFAQs
Macromedia Flash
Adobe PhotoShop
Expression Blend
Expression Design
Expression Web

OtherArticlesForumsFAQs
Lounge
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Product Reviews
Search Engines
Resumes

 

  View Other C# .NET Posts   Ask New Question  Ask New Question With Power Editor

Master page in ASP.net
Abhi Rana posted at Saturday, November 07, 2009 12:50 AM

How could we enable and disable Master page on runtime.

I have aspx page that has master page, I want to set it visible false at run time.

Reply    Reply Using Power Editor
  Rank Winnings Points
November 0 $0.00 0
October 0 $0.00 0
Disable Master Page
F Cali provided a rated reply to Abhi Rana on Saturday, November 07, 2009 1:00 AM

Taking it from the following link:

http://www.eggheadcafe.com/community/aspnet/7/10021745/disable-master-page.aspx

"Create a second master page that is effectively blank. Then use the PreInit method of the page to check for your target situation and load the blank master page instead."

Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As EventArgs) Handles Me.PreInit

If SpecialSituation = True Then
Me.MasterPageFile = "CustomAppBlank.master" End If End Sub
Reply    Reply Using Power Editor
How well do you know SQL? Find out with the free test assessment from SQL Server Helper:
http://www.sql-server-helper.com/free-test/default.aspx
  Rank Winnings Points
November 3 $68.00 166
October 0 $0.00 0

Re:
web mavin replied to Abhi Rana on Saturday, November 07, 2009 1:07 AM

The first option that comes to my mind is setting visibility of all controls inside master page at runtime. That should be easy. Or you could have another empty master page and set that when you want to hide the current one.
Reply    Reply Using Power Editor
  Rank Winnings Points
November 8 $22.00 53
October 7 $38.00 131

Also..
web mavin provided a rated reply to Abhi Rana on Saturday, November 07, 2009 1:09 AM

you could expose the Table from the master page. You can do that by addind a property to your master page. From the Content page you can use the Master class to access your property: 

MasterPage:
public Table GetTable
{
    get { return myTable1; }
}
Conentpage:

Master.GetTable.Visible = false;

Check out this post for more details of how you use the Master class to access a member located in a master page file.
Reply    Reply Using Power Editor
  Rank Winnings Points
November 8 $22.00 53
October 7 $38.00 131