Page_load fires last on postback

C

choukrou

Hello everybody!

Got a nice problem on 1 of my aspx (and only one): It was working
"perfectly" for 1year and a half. Last week I had to fix a lil bug. I
do that and test my app. And on the fixed page, on the first load
everything is allright.

But on postback, it seems that the Page_load event is the last fired.
But in this event, obviously, i'm initializing some vars like my
connection string, to use in my others events and functions. So on the
first load my vars are ok and everything works, but on the postback,
when I call my connection string var on the MyDatagrid_ItemCreated and
it's empty, there's a little big error message...

My bugfix doesn't seems to be the source of the problem because:
I fix a function of me, I didn't touched anything else. And it's not a
function to launch a rocket for the N.A.S.A., just to access a DB and
return a string.

I took back my bugged page and replaced my fix by a thing like
if(true){} And the Page_load still fires after all others events on
postback.

I tried to modify another page, but everything works perfectly, the
page_load is always first.

Have u any idea to fix this problem? I searched the newsgroups, saw
like 2 messages with the same problem but nothing very helpfull to try.
Is that a problem between the chair and the keyboard, or something
else?

Thanks for your help by advance and scuse me for my English
 
F

Felix Piskunov

Try to use Page_PreInit (or Page_Init) instead of Page_Load.
It doesn't fix the problem with Page_Load, but it should solve your problem
widht access to DB
 

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

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top