Which Page_Load event is raised first?

G

Guest

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.
 
K

Karl Seguin [MVP]

It's recursing starting from the page to controls, to child controls.

Karl
 
G

Guest

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.
 
K

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
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top