Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Control events - page life-cycle

Reply
Thread Tools

Control events - page life-cycle

 
 
Griff
Guest
Posts: n/a
 
      09-20-2006
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



 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      09-20-2006
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
>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
>
>
>



 
Reply With Quote
 
 
 
 
Griff
Guest
Posts: n/a
 
      09-20-2006
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


"Cowboy (Gregory A. Beamer)" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> 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.



 
Reply With Quote
 
Griff
Guest
Posts: n/a
 
      09-20-2006
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)" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> 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.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
runtime events that generate other controls and events newbye ASP .Net 0 07-06-2006 06:27 PM
Events Events Events Please Help Chris ASP .Net Web Controls 0 08-30-2005 08:21 PM
order of events - dynamic checkbox events =?Utf-8?B?bG91aXNlIHJhaXNiZWNr?= ASP .Net 0 08-17-2005 10:36 PM
Re: passing variables between web page events & httpmodules events Alvin Bruney ASP .Net 1 11-24-2003 04:14 PM
Passing Variables between Web Page Events and HttpModule Events shiv ASP .Net 0 11-21-2003 04:29 PM



Advertisments