Dheeman Dutta

Just Another Blog.....

  Home  |   Contact  |   Syndication    |   Login
  39 Posts | 1 Stories | 29 Comments | 12 Trackbacks

News



Archives

Post Categories

.NET Links

pageBaseType is an extremely powerful setting that you might to use when all your application pages inherit from a common class. it is in the section of the web.config.
posted on Sunday, July 23, 2006 11:08 AM

Feedback

# re: PageBaseType 6/11/2007 11:20 PM Ravi
Hi,
Can you share a real life example.

Thanks
Ravi

# re: PageBaseType 6/12/2007 6:04 PM Dheeman Dutta
Suppose you are trying to load a Masterpage explicitly using code based on some conditions , and this applies to all the pasge in your website. Using this contaring for loading master pages , you won't be able to specify the master page while adding any page in the website.

Suppose we have this class
>>>>>
public class DynamicMasterPage : System.Web.UI.Page
{
protected override void OnPreInit(EventArgs e)
{
// LoadMasterPage() loads a master page based on some criteria.
string masterFile = LoadMasterPage();
if (!masterFile.Equals(string.Empty))
{
base.MasterPageFile = masterFile;
}
base.OnPreInit(e);
}
}
>>>>>>

Now in order to make all pages in your website inherit from this class you need to mention the pageBaseType in the Web.Config.

>>>>

<system.web>
<pages pageBaseType="DynamicMasterPage" />
</system.web>

>>>>>


Cheers

# re: PageBaseType 4/21/2008 6:57 AM Vladimir Kelman
Only works with inline ASPX pages, unfortunately. VS still generates code-behind pages inheriting System.Web.UI.Page, which overrides pageBaseType. So, it is pretty useless.

http://pro-thoughts.blogspot.com/

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: