Interviews - C# Corner

Rajesh Gami
How can we change a Master Page at runtime?
By Rajesh Gami in .NET Standard onFeb 26 2018
  • Rajesh Gami
    Feb, 2018 26

    Using page events we can change the master page during runtime. In Page_PreInit() event we can change the master page by setting the “MasterPageFile” property to the path of the master page what we have to set.

    • 3
  • Pankaj Kumar
    Jun, 2018 19

    Write the code behind of the content page (.aspx.cs)protected void Page_PreInit(object sender, EventArgs e) {this.MasterPageFile = "~/MasterPage2.master"; }

    • 1

Most Popular Companies

Most Popular Job Functions

MOST LIKED QUESTIONS