Perhaps I'm reading this wrong, but wouldn't/couldn't you set this in a page
and inherit it?
For example, if you have a BasePage that all of your other pages inherits.
~/App_Data/BasePage.cs contains:
public class BasePage : Page
{
public BasePage() : base()
{
base.PreInit += new EventHandler(Page_PreInit);
}
protected void Page_PreInit(object sender, EventArgs e)
{
this.MasterPageFile = "~/MasterPage.master";
}
---
~/Default.cs (code-behind for Default.aspx) contains the simple inheritance
of your BasePage:
public partial class _Default : BasePage
{
%code behind code%
}
---
Hope that helps or is what you're looking for. (^_^)
-dl
--
David Longnecker
Web Developer
http://blog.tiredstudent.com
I'm looking to discover in what event I can programmatically set
this.MasterPageFile for a master page.
Documentation states that this property must be set in the PreInit or
before, but master pages don't have a PreInit event -- just an Init
event.
So what event is available to a master page that comes before PreInit
that can be used to programmatically set the MasterPageFile property?
Thanks in advance!