Home All Groups Group Topic Archive Search About

Which Page_Load event is raised first?

Author
20 Jan 2006 3:28 PM
Andrew
Hello, friends,

In a .aspx page, we have a web user control.

In both control and .aspx page, we have Page_Load event.

My question is: Which event will raised first when rendering this page to
clients? Can I change web user control's properties in .aspx Page_Load event
so that  control's Page_Load can use the new property values I just assigned?

Thanks.

Author
20 Jan 2006 3:40 PM
Karl Seguin [MVP]
It's recursing starting from the page to controls, to child controls.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/


Show quote
"Andrew" <And***@discussions.microsoft.com> wrote in message
news:3C2F5070-EB9E-48D3-B209-0037258AC733@microsoft.com...
> Hello, friends,
>
> In a .aspx page, we have a web user control.
>
> In both control and .aspx page, we have Page_Load event.
>
> My question is: Which event will raised first when rendering this page to
> clients? Can I change web user control's properties in .aspx Page_Load
> event
> so that  control's Page_Load can use the new property values I just
> assigned?
>
> Thanks.
Author
20 Jan 2006 3:56 PM
Andrew
Thank you, Karl,

In .aspx html, I have:

<uc1:MainMenu id="MainMenu1" name="MainMenu1" runat="server"></uc1:MainMenu>

But, in Page_Load event (c#), I could not see this.MainMenu1. I thought I
should be able to see this web user control I dropped on this page??

Any reference paper, or sample source code? Thanks a lot.



Show quote
"Karl Seguin [MVP]" wrote:

> It's recursing starting from the page to controls, to child controls.
>
> Karl
>
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
>
> "Andrew" <And***@discussions.microsoft.com> wrote in message
> news:3C2F5070-EB9E-48D3-B209-0037258AC733@microsoft.com...
> > Hello, friends,
> >
> > In a .aspx page, we have a web user control.
> >
> > In both control and .aspx page, we have Page_Load event.
> >
> > My question is: Which event will raised first when rendering this page to
> > clients? Can I change web user control's properties in .aspx Page_Load
> > event
> > so that  control's Page_Load can use the new property values I just
> > assigned?
> >
> > Thanks.
>
>
>
Author
20 Jan 2006 4:16 PM
Karl Seguin [MVP]
It's possible that the decleration for the control simply didn't make it
into codebehind. Sometimes it's automatically generated, sometimes it isn't.

Expand the auto-generated region in your codebehind, and see if you have a
MainMenu1 variable defined, ala:


protected MainMenuMainMenu1;

if it isn't htere, simply add it.
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/


Show quote
"Andrew" <And***@discussions.microsoft.com> wrote in message
news:3B0B6F6A-BB17-4D42-A6D6-63B972E352F5@microsoft.com...
> Thank you, Karl,
>
> In .aspx html, I have:
>
> <uc1:MainMenu id="MainMenu1" name="MainMenu1"
> runat="server"></uc1:MainMenu>
>
> But, in Page_Load event (c#), I could not see this.MainMenu1. I thought I
> should be able to see this web user control I dropped on this page??
>
> Any reference paper, or sample source code? Thanks a lot.
>
>
>
> "Karl Seguin [MVP]" wrote:
>
>> It's recursing starting from the page to controls, to child controls.
>>
>> Karl
>>
>> --
>> MY ASP.Net tutorials
>> http://www.openmymind.net/
>>
>>
>> "Andrew" <And***@discussions.microsoft.com> wrote in message
>> news:3C2F5070-EB9E-48D3-B209-0037258AC733@microsoft.com...
>> > Hello, friends,
>> >
>> > In a .aspx page, we have a web user control.
>> >
>> > In both control and .aspx page, we have Page_Load event.
>> >
>> > My question is: Which event will raised first when rendering this page
>> > to
>> > clients? Can I change web user control's properties in .aspx Page_Load
>> > event
>> > so that  control's Page_Load can use the new property values I just
>> > assigned?
>> >
>> > Thanks.
>>
>>
>>

AddThis Social Bookmark Button