473,785 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(ob ject sender, System.EventArg s args)
{
this.Page.Theme = "Web";
}

Why?
Aug 5 '06 #1
1 6889
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.P age. 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(ob ject sender, System.EventArg s 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
2788
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. So the masterpage code would 1) create the public string DBConn and 2) check the public string SubLinks if it contains any links after the content page was run (if not, hide the sublink bar). Using Page_OnLoad event the masterpage code is run...
3
28053
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 starts. (I recall that someone told me in VS2003 that you could not count it!) I'm using C#.NET 2005 so if that was an issue in 2003, is it still an
1
1055
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 include a file but I can't figure out how to accomplish this is .NET What I'm trying to do is setup a group of pages that depending on which subdomain will programmatically use a different masterpage. I'm assuming I have to set the MasterPageFile...
5
1742
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 between them it don't work, if the default masterpage is "onepanel.master" and try to change it in runtime, ContentPanel2 which is exist in the loaded masterpage throw exception.. the same happen if the default is "twopanel.master" and switch it...
9
3416
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 the value of the DropDownList in the Page_PreInit event. How can I do that? The content in the content and master pages is based on
7
4214
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 of placing the code below in every page codebehind, I could code it just once. Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
4
2135
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 and load via page.MasterPageFile? Thanks,
4
13034
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 works on every pageLoad. seems my problem is solved. But when the pages uses UpdatePanel and it gets asynchronously postback. the function call at master page doesnt execute????? thought master page Load event gets called even when pages are in...
18
5435
by: Redhairs | last post by:
Is it possible to get DropDownList.SelectedValue in Page_PreInit() event during the postback?
0
9646
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10096
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.