Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page_Load firing later then hoped

Status
Not open for further replies.

ralphtrent

Programmer
Jun 2, 2003
958
US
Hi
I am using asp.net 2.0. I have an ASPX with 2 ASCX. In the first ASCX I have a form or selectables, in the second I have another form of selectables. In my ASPX, I accept a QueryString called Action, if that value is EDIT. then I need to put both ASCX's in edit mode (basically, just prefill the forms). in the first ASCX I read the querystring from the page and if it is EDIT then I proceed to prefill, that controls objects. I also attempt to prefile the objects in my second control with int he same code. So I need to search the page for the controls with in the ASCX to prefill them. That is all good, but the problem I am having is in the second ASCX my Page_Load is not firing until after I atempt to preload the objects. In the Page_Load of the second ASCX I prefill default values for a dropdownbox. But since the Page_Load is not firing, when I attempt to preselect a value from the dropdownbox, the values are not there, there for, not preselecting the correct value.

So, how do I make Page_Load code execute as soon as the page is loaded but before I do any prefilling. I have also added my Page_Load code to Page_Init and Page_PreRender.

I can supply code if helpful, but I just need to know the general idea. I can put the prefilling of the object in ASCX Page_Load, but I was trying to save a trip to the database to get the data again.

Any help is appreciated.

Thanks,
RalphTrent
 
I am not exactly clear on what you are trying to do, or what you are doing becuae you have not posted any code. You cannot change the order that events fire in.

If you want to prefill values in each ascx, then you should do this from the containing page. Grab the querystring, and then set properties on each ascx that will be used to prefill your ddls.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top