Problematic Postbacks

Discussion in 'ASP .Net' started by Duray AKAR, Aug 12, 2003.

  1. Duray AKAR

    Duray AKAR Guest

    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



    >-----Original Message-----
    >I have been having this problem sporadically for the past

    year. The basic
    >issue is this, during a postback (say a button press), i

    make a change to
    >the state of the application (say, update a database),

    and call methods that
    >should update the status of the page to reflect it.

    However, the Page does
    >not update until the SECOND time the button is pressed.

    However, the changes
    >are made on the first press (checked the databasE).

    Example. There is a
    >label displaying the current poll number. It is a

    databound control. I use a
    >datagrid to select another poll number and click the

    update button. Nothing
    >happens, but in the databse, the current poll has

    updated. I pick another
    >poll from the datagrid and hitr update, and the FIRST

    poll i picked is
    >displayed. However, in the database, it is updated with

    the new information.
    >Does anyone have any insight on this matteR? Thanks.
    >
    >
    >
    >
    >.
    >
     
    Duray AKAR, Aug 12, 2003
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lim Siew Cheng

    Re: Problematic Postbacks

    Lim Siew Cheng, Aug 12, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    434
    IbrahimMalluf
    Aug 12, 2003
  2. Fraggle
    Replies:
    1
    Views:
    476
    Fraggle
    Nov 27, 2003
  3. Jason Shohet

    XHTML problematic, in xml used w/ .net

    Jason Shohet, Jun 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    362
    Trevor Benedict R
    Jun 30, 2004
  4. Danny Ni

    ASP.Net Datagrid paging problematic?

    Danny Ni, Oct 30, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    503
    Saravana
    Oct 30, 2004
  5. Replies:
    0
    Views:
    542
Loading...

Share This Page