473,652 Members | 3,045 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Control events - page life-cycle

I want to build a set of compiled user controls to incorporate into a web
site.

The majority of user controls will be placed on specific web page and these
controls would share a common interface. The interface would expect some
sort of "end user identitifier" argument, perhaps a GUID.

I thought that this user identifier GUID could be generated by a common user
control (either from state information held on the client cookies, or in the
database or where-ever...). This common control would therefore be best
placed on a master page that was inherited by all the web pages.

The problem is of course the event life cycle...
1. Default Page's Control's Page_Init()
2. Master Page's Control's Page_Init()
3. Master Page's Page_Init()
4. Default Page's Page_Init()
5. Default Page's Page_Load()
6. Master Page's Page_Load()
7. Default Page's Control's Page_Load()
8. Master Page's Control's Page_Load()

I'd obviously require the common control (on the master page) to fire BEFORE
the specific control on the page....and this won't happen.

I'm sure that this is a common problem, but am having a hard time finding a
suitable work-around. Any help most appreciated.

Thanks

Griff

Sep 20 '06 #1
3 2426
Here is an option: Set up a property on the control in question and use the
property load to set the control to the state you desire.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** ****
Think outside of the box!
*************** *************** *************** ****
"Griff" <ho*****@the.mo onwrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>I want to build a set of compiled user controls to incorporate into a web
site.

The majority of user controls will be placed on specific web page and
these controls would share a common interface. The interface would expect
some sort of "end user identitifier" argument, perhaps a GUID.

I thought that this user identifier GUID could be generated by a common
user control (either from state information held on the client cookies, or
in the database or where-ever...). This common control would therefore be
best placed on a master page that was inherited by all the web pages.

The problem is of course the event life cycle...
1. Default Page's Control's Page_Init()
2. Master Page's Control's Page_Init()
3. Master Page's Page_Init()
4. Default Page's Page_Init()
5. Default Page's Page_Load()
6. Master Page's Page_Load()
7. Default Page's Control's Page_Load()
8. Master Page's Control's Page_Load()

I'd obviously require the common control (on the master page) to fire
BEFORE the specific control on the page....and this won't happen.

I'm sure that this is a common problem, but am having a hard time finding
a suitable work-around. Any help most appreciated.

Thanks

Griff

Sep 20 '06 #2
Hi Gregory

So, just thinking this through, the following steps would need to occur in
sequence

In the web page load event
1 - WebPage.UserCon trol.UserID = MasterPage.User Control.GetUser Guid()
2 - WebPage.UserCon trol.GenerateOu tput()

Yup - think that would work....thanks

Griff
"Cowboy (Gregory A. Beamer)" <No************ @comcast.netNoS pamMwrote in
message news:uG******** ******@TK2MSFTN GP06.phx.gbl...
Here is an option: Set up a property on the control in question and use
the property load to set the control to the state you desire.

Sep 20 '06 #3
Hi Gregory

I seem to have hit a bit of a stumbling block....

I want the Master Page's control to generate a GUID that identifies the end
user. This will be on a Master page because I want it on EVERY web page. I
presume that the earliest that this function could be called would be AFTER
the Master Page's Control's Page_Load() event has been fired.

I then want the web page's Control to take in this GUID and then, based on
some business logic, load another specific User Control at run time. Using
the MVC model, it's a way of saying that the View used by every control is
dependent upon the user calling it.

But it appears that the event order prevents this....

Griff

"Cowboy (Gregory A. Beamer)" <No************ @comcast.netNoS pamMwrote in
message news:uG******** ******@TK2MSFTN GP06.phx.gbl...
Here is an option: Set up a property on the control in question and use
the property load to set the control to the state you desire.

Sep 20 '06 #4

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

Similar topics

1
2739
by: Ole Hanson | last post by:
Hi I am having a number of User Controls (ascx) on my page (aspx). The page is in my scenario only working as a dumb "container "giving life to the Controls, as these are handling my UI-logic and communicating with each other (the controls are communicating) by subscribing to each others events. (e.g. pressing a selection in Control1 will "trigger" the content of Control2). It is done in this way:
8
1818
by: John Smith Jr. | last post by:
I am looking for some way to persist a table web control so when page_load event comes up, i can display the table as it was. I tried using ViewState with the rows collection but that didn't work to well as I got an error trying to put rows collection in the viewstate. My problem is this: I load a table with rows and controls, then wire events, this is after clearing the rows of the table initially in this function.
1
8155
by: Earl Teigrob | last post by:
PROBLEM: When a user control is loaded into a PlaceHolder control more than once, the events do not fire on the first click of a control on the dynamically loaded user control. In other words, the first time the control is dynamically loaded, everything works fine. After that, if the control is loaded again from the page button event handler, the user controls events fail to fire on the first click NOTE: I (believe I) am rebuilding all...
10
2491
by: George G. | last post by:
Hi there, I am busy writing a new asp.net application and I am reusing some of my existing asp functions and methods in a user control. I need access to session, request and response in some of the functions and I can't find out how to do it. Here is an example of what I do and I get the following Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the...
6
1970
by: MattB | last post by:
I have a page header that I made as a user control (ascx) that I drop on every page in my application. The application is an eCommerce application and I have a total for items in the cart on the header. To keep this total in sync, I count the items in the cart and refresh the label text in the load event of my header control. This all works well, except for one scenario. When the user is on the "Show Cart" page, they can delete items from...
3
2593
by: Tome73 | last post by:
Could someone give me a comprehensive order of events as they pertain to web controls within a page. The page events are: Page_Init Page_Load Page_PreRender Page_Unload Page_Disposed So where would the Init and Load events of web controls fit into the page events. Would it be?
0
1441
by: Klaus Jensen | last post by:
Hi! This has been annoying me for a while now, and I can't get it to work It is really driving me nuts! Basicly this simple webapp created to illustrate my problem, renders five buttons, and adds a handler to the click event. When a button is clicked, the background-color is set to blue.
4
1747
by: thomson | last post by:
Hi all, i do have a user control with 4 buttons, and all the events are firing properly, My problem is that i need to right an event handler in the user control, which gets fired after a specific process is done,, but the form which will host the user control has to specify what has to be done Something like this , if the event is fired it should call the event in
9
3183
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will load with different data (locations, departments, etc.).
1
2080
by: Jordan S. | last post by:
I'm just wondering if this would work. Please note that I'm not asking *how* to raise events. I'm clear on that. What I'm not clear on is the sequence in which events are raised by custom controls relative to the hosting Page, and therefore if the following specific arrangement would even work. What I'm looking to do is dynamically insert multiple custom composite Web server controls onto a blank Page. This is no problem, I know how to do...
0
8279
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
8811
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8703
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...
0
8589
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6160
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
5619
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
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2703
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
1591
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.