Interviews - C# Corner

Raghvendra Singh
Master pages can be changed dynamically or not?
By Raghvendra Singh in ASP.NET onJun 22 2009
  • jitendra patel
    Aug, 2010 13

    protected void Page_PreInit(object sender, EventArgs e)
    {
       Page.MasterPageFile = "~/MasterPage.master";
    }

    • 0
  • jitendra patel
    Aug, 2010 13

    this code write before page_Load event

    protected void Page_PreInit(object sender, EventArgs e)
    {
       this.MasterPageFile = "~/MasterPage.master";
    }

    • 0
  • PEEYUSH MISHRA
    Jul, 2009 21

    Master pages are a feature in ASP.NET 2.0. They allow you to easily create a consistent feel throughout our website. They also provide an easy way to set/change the master pages at runtime. This is achieved by setting the MasterPageFile property of a page in the PreInit event.

    protected void Page_PreInit(object sender, EventArgs e)
    {
       this.MasterPageFile = "~/MasterPage.master";
    }

    • 0
  • Bishwajit Saha
    Jun, 2009 23

    Raghvendra, off course you can do dynamically. MasterPage masterPage = new MasterPage(); masterPage.MasterPageFile = "abc.master"; .. ..

    • 0

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS