Problem with Page_load and Button_Click event , wrong order

  • Thread starter Thread starter Skating_vince
  • Start date Start date
S

Skating_vince

I have a problem, i have a form with some input boxes and a submit
button. In the Submit_Click event, the data from the input boxes is
stored in a database.

But, if you click the button, ASP.NET will first load the next
Page_Load and when that is done, it will do the Submit_Click event.
So on the page you don't see the data from the database, because it
is not there yet. When you refresh the page, the data is there, but
it has to be there without the refresh!

does anyone know how to fix this?

Greetz Vincent Scheel from the Netherlands
 
Hi there,

Try to load you value in if(!ispostback) condition, then value will be
loaded only once.

Harshdeep Mehta
 
No, that's the problem, it has to be loaded, but only after the data
is changed in the database, but because of ASP.NET doing the
Button_Click event after the Page_Load, the data in the database
hasn't changed yet.
 
Back
Top