Page_PreInit no execute in MasterPage

A

ad

Hi,

I have set the this.Page.Theme in a MasterPage, but it no affect.
I have set break point at this line, but it never execute.

void Page_PreInit(object sender, System.EventArgs args)
{
this.Page.Theme = "Web";
}

Why?
 
G

Guest

There is not PreInit event in the MasterPage.
MasterPage actualy is a UserControl which dosen't has PreInit.
Adding method Page_PreInit doesn't also mean that there is an event named
PreInit on masterpage. to prove that, try to add:
protected override OnPreInit(...), the compiler will not accept it.

To solve your issue, I suggest to create class Named BasePage or what ever
which inherits from System.Web.UI.Page. Make all your Pages Inherits from it.
and add your Page_PreInit on it, then set your MaterPage in this event.

Regards
--
Muhammad Mosa
Software Engineer & Solution Developer
MCT/MCSD.NET
MCTS: .Net 2.0 Web Applications
MCTS: .Net 2.0 Windows Applications
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top