C# .NET - Master page in ASP.net

Asked By Abhi Rana
07-Nov-09 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.

Disable Master Page  Disable Master Page

07-Nov-09 01: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
  web mavin replied to Abhi Rana
07-Nov-09 01: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.

Also..  Also..

07-Nov-09 01: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;

http://normen.mine.nu/MyBlog/viewpost.aspx?PostID=123 for more details of how you use the Master class to access a member located in a master page file.
Create New Account
help
How can we know a state of a thread? (A) What is use of Interlocked class ? (A) What is a monitor object? (A) What are wait handles? (A) What is ManualResetEvent and Webservices (B)What is an application domain? (B) What is .NET Remoting? (B) Which class does the remote object has to inherit? (I) what are two different types of remote using cache object of ASP.NET? (B) How can you cache different version of same page using ASP.NET cache object? (A) How will implement Page Fragment Caching? (B) Can you compare ASP.NET sessions with classic ASP? (B) Which are of using Query Strings? (I) What is Absolute and Sliding expiration? (I) What is cross page posting? 93 (I) How do we access viewstate value of this page in the next page ? (I) Can we post and access view state in another application? (I) What is SQL Cache substitution? Chapter 6: OOPS (B) What is Object Oriented Programming? (B) What is a Class? (B) What is an Object? (A) What is the relation between Classes and Objects? (B
alot var Hi What are Master Pages in ASP.NET? or What is a Master Page? ASP.NET master pages allow you to create a consistent layout for the pages in your application. A single master page defines the look and feel and standard behavior that you want for all of the you want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page. What are the 2 important parts of a master page? The following are the 2 important parts of a master page 1. The Master Page itself 2. One or more Content Pages Can Master Pages be nested? Yes, Master Pages
cannot be used with indexers, destructors, or types. In C#, the static keyword indicates a class variable. In VB, the equivalent keyword is Shared. Its scoped to the class in which it occurs. Example a. Static int var / / in c#.net b. static void while creating an ASP.NET application? There are two level of asp.net debugging 1. Page level debugging For this we have to edit the page level debugging enable the trace to true in the line in the html format of the page. %@ Page Language = ”vb” trace = ”true”AutoEventWireup = ”false” Codebehind = ”WebForm1.aspx.vb” Inherits = ”WebApplication2.WebForm1?> 2 Enable trace enabled = true. If there is a calendar control to be included in each page of your application, and and we do not intend to use the Microsoft-provided calendar do you develop it? Do you copy and paste the code into each and every page of your application? Create the Calendar User Control The control we will create will contain
Page Directive? What is the purpose of page directive in aspx page? Directive Syntax Directives are instructions used to specify settings (related to how a page should render and processed) used by the page and user control compilers when they process ASP.NET Web Forms page (.aspx) and user control (.ascx) files. These are the essential part of every ASP.NET Page or Control. Directives can be located anywhere in an .aspx or .ascx file, but the values, same as any HTML tag) that are specific to that directive. Special Note: The @ Page directive can be used only in .aspx files, and the @ Control directive can be used