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
-----Original Message-----
I have been having this problem sporadically for the past year. The basicissue is this, during a postback (say a button press), i make a change tothe state of the application (say, update a database), and call methods thatshould update the status of the page to reflect it. However, the Page doesnot update until the SECOND time the button is pressed. However, the changesare made on the first press (checked the databasE). Example. There is alabel displaying the current poll number. It is a databound control. I use adatagrid to select another poll number and click the update button. Nothinghappens, but in the databse, the current poll has updated. I pick anotherpoll from the datagrid and hitr update, and the FIRST poll i picked isdisplayed. However, in the database, it is updated with the new information.Does anyone have any insight on this matteR? Thanks.
.