Problematic Postbacks

D

Duray AKAR

Most probably, you are loading the data to the label
before you submit the update.

I dealt with that type of an isssue before, you question
is not descriptive enough to make certain decisions, but i
guess your control is data bound, you are loading the data
in page_load, then the button_click sends the update, and
you are binding data after the update, BUT NOT RETRIEVING
THE DATA AGAIN. So debug the code to make sure that the
events are in this order starting with the button click :

1) The update button is clicked
2) The code to update the database is called
3) The code to retrieve the updated data is called
4) The code to bind the updated data to the label is
called.

Make sure step 3 occurs AFTER the data update code.
I had a complaint exactly like yours in which the order
was 3,1,2,4...

Being more specific, the dataset that used to bind the
value was being loaded in the page_load,
which fires before the button_click ,
then the update code was being called in Button_Click,
and then the databinding code was being called after the
update,
which leaves you with the previous values you loaded in
page_load.

On the second click, you get the data you updated in the
first click, send the update, bind the data, bumm, you get
the first update just now. So you are one cycle behind the
actual value...

The firing order of the basic events are:
Page_Init
Page_Load
Button_Click
Page_PreRender
The code in <% %> on the aspx page (if you have any
databinding in the aspx page like DataSource='<% ds1 %>')


Hope it helps..

Duray AKAR
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top