Problem with Page_load and Button_Click event , wrong order

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
 
H

Harshdeep Mehta

Hi there,

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

Harshdeep Mehta
 
S

Skating_vince

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.
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top