Control events - page life-cycle

G

Griff

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
 
C

Cowboy \(Gregory A. Beamer\)

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!
*************************************************
 
G

Griff

Hi Gregory

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

In the web page load event
1 - WebPage.UserControl.UserID = MasterPage.UserControl.GetUserGuid()
2 - WebPage.UserControl.GenerateOutput()

Yup - think that would work....thanks

Griff
 
G

Griff

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
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top