473,795 Members | 2,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setting masterpage event other than OnLoad

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 after the
content page which is fine for 2). For 1) I need it to run BEFORE and I
tried using

void Page_OnPreInit (System.EventAr gs e) ...

and even

protected override void OnPreInit(Syste m.EventArgs e) ...

The first line is never run in the first place (not even Page_OnPreInit) .
The second line creates error "no suitable method found to override".

So how do I create a masterpage event other than OnLoad???
Nov 19 '05 #1
1 2789
I have a blog entry that describes how to dynamically choose a MasterPage
(and Theme) without putting the code in Page_PreInit of every page:

http://staff.develop.com/ballen/blog...c-13818fd75a56

-Brock
DevelopMentor
http://staff.develop.com/ballen
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 after the content page which is fine
for 2). For 1) I need it to run BEFORE and I tried using

void Page_OnPreInit (System.EventAr gs e) ...

and even

protected override void OnPreInit(Syste m.EventArgs e) ...

The first line is never run in the first place (not even
Page_OnPreInit) . The second line creates error "no suitable method
found to override".

So how do I create a masterpage event other than OnLoad???


Nov 19 '05 #2

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

Similar topics

4
4918
by: Pai | last post by:
hello there, I am trying to rersize the window it works find in IE but doea not work with mozilla window.attachEvent(onload,MWSOnLoad); window.onload = function (MWSOnLoad) { alert('hello'); window.resizeTo(810,750); top.outerWidth=810;
3
3044
by: Daves | last post by:
how can I set events other than Page_OnLoad for masterpage in 2.0? Because I need to have some code being run before the content page OnLoad event is run...
3
1317
by: Newbie | last post by:
Hi, For my recent web project, I need to built a site which has 3 language. The content pages are identical, so it only the language that differ. What I planned is: I'll build a masterpage for each language, and fill up the content from the database, based on selected language. My question is: is it possible to determine what masterpage to use at runtime, that is based on visitors choice of language. Or, are there any other...
6
9569
by: pronerd | last post by:
Hi, I am trying to dynamically set an event handler across frames. I have no problems setting properties across frames doing something like parent.ToolMenuFrame.location.href = 'http://www.blah blah blah.com'; But when I try to set an event handler this way, as shown below, it fails. parent.ToolMenuFrame.window.document.body.onload = "alert('On Load Trigger Fired!!');"; parent.ToolMenuFrame.document.body.onload = "alert('On Load...
1
1172
by: =?Utf-8?B?Q2hhZCBU?= | last post by:
I am very new to asp.net (I know asp better) and have hit a road block. I have a master page that links to a content page. The purpose of the content page is to edit the database record. I have decided to not use gridview or details view because I need to do some manipulation of the data and control the look alittle more. I have a few textboxes on the contentpage and an update button. When the page loads the textboxes are loaded with...
5
2041
by: Finn Stampe Mikkelsen | last post by:
Hi How can i set a focus to a textbox in my codebehind page?? I have this WebForm, that takes information from a user and 2 buttons on the form. One that takes action on the entered information and one that resets the form... The second on, the reset button, i would like to set focus back to the first textbox on the form. I already have an onload in my body, which sets the
1
1845
by: =?Utf-8?B?Sm9obg==?= | last post by:
I have a dropdownlist in masterpage and a big table in contentpage. When ddl selection changes, I want to move a specific row of the table to the top of the contentpage. Can I do something like <a href="#mid"in ddl event handler? Maybe a Javascript? Please advise. Thanks.
3
3347
by: jobs | last post by:
Hello. How can a set the Body onload from a content page since Body is on the masterpage? on my master page: <body runat="server" id="Body" > How can I reference Body. on the content page's codebehind?
4
13037
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...
0
9673
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
10217
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
10167
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,...
1
7544
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6784
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
5440
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...
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2922
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.