User Control and Page Load

  • Thread starter Thread starter Jonathan
  • Start date Start date
J

Jonathan

Hi everyone, first of all I am sorry if my english is not so good
because I'm italian. The problem I need to solve is:
in a WebForm (WF) I have a UserControl (UC) wich contains some
controls. The first event that ASP.NET runs is WF_pageload but I'd
need UC_pageload event to run first. Does anyone know how to help me?

Jonathan
 
Hi, Jonathan,

Move the code in the UC_pageload to another method in the UserControl class.
Then just call this method from the Page_Load handler of the webform.

Hope this helps
Martin
 
Hi Jonthan

Well, you are asking some thing that framework should go reverse

What i mean is, whenever you creare a User Control and Register the User Control in a
Web Form, what happens is, First the Page_Load event of the Web Form gets called
After this is the Page_Load of the User Control happens
This is how the .NET frame work is built upon

If you send the scenario what you are trying to do
we can see the alternative
 
Hi Martin

I agree with you

This can be a turn around for the scenario that jonath needs

He can create a public property or method in the UC and call it from the WF

regard
Kashyp
 
Back
Top