473,395 Members | 1,701 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Page_PreInit no execute in MasterPage

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?
Aug 5 '06 #1
1 6867
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
"ad" wrote:
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?
Aug 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Daves | last post by:
I am using 2.0 masterpages. All content pages use some common variables, for example the DB connection string. Also some pages return links which are located in a "sublink" area in the masterpage....
3
by: Fred Nelson | last post by:
Hi Folks: I have a question about the Page_PreInit and Page_Load events in a web application. My question is: can I count on the Page_PreInit having completed before the Page_Load event...
1
by: ryanmhuc | last post by:
I'm new to .NET and I'm still trying to adapt from PHP. Especially when dealing with includes. I would like a group of pages to all execute the same Page_Preinit event code. In php I would just...
5
by: Islamegy® | last post by:
In my project i have two master page which i change dynamic in runtime.. The first one with 1 ContentPanel "onepanel.master", the second with 2 contentPanel"twopanel.master".. but when i switch...
9
by: Lammert | last post by:
Good morning, I create an ASP.NET 2.0 web application. The situation: 1. One masterpage where the users can select an organisation in a DropDownList. 2. Different content pages. I will get...
7
by: Edward | last post by:
Hi All, Would anyone know if there is an event similar to the Page_PreInit that I can code just once, at a global initialization level, that applies to all pages executed? Therefore, instead...
4
by: paul1664 | last post by:
Hi, I'm currently loading my masterpage from a file via an httpmodule. How can I modify this code to load the masterpage from a database? Is the only way to save the file to a temp file first...
4
by: faraz | last post by:
I have a javascript function that i want to call masterpage load method called. I cant add onLoad event of body or table in master page. I have put the call to script function in <form>, it...
18
by: Redhairs | last post by:
Is it possible to get DropDownList.SelectedValue in Page_PreInit() event during the postback?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.