Problematic Postbacks

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Re: Problematic Postbacks


    this may be a stupid response,
    after updating the database, how about rebounding the label ?



    news.microsoft.com wrote:
    > 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.
    >
    >
    >
    >
    Lim Siew Cheng Guest

  2. Similar Questions and Discussions

    1. Conversion from 1.5 to 2.0 problematic
      I'm having trouble converting documents from InDesign 1.5 to 2.0 -- during the "Open Document" phase, the "converting data" bar gets to about 35% and...
    2. Fwd: [PHP-DEV] ZEND_DISABLE_MEMORY_CACHE=0 problematic on
      FYI, this should be fixed now. If anyone still bumps into weird performance problems relating to the memory manager please let me know. Andi ...
    3. [PHP-DEV] ZEND_DISABLE_MEMORY_CACHE=0 problematic on large arrays
      http://cvs.php.net/diff.php/ZendEngine2/zend_alloc.c?r1=1.118&r2=1.119&ty=h&num=10 " - Add heap to memory manager. This should improve...
    4. Problematic delay in script
      Hello, I have created a mailing program for our company that sends out emails to our client database. There seems to be a delay in the script or...
    5. problematic behaviour of movies using XML parser scripts in shockwave - !!!
      hi, all! we are in the process of testing XML parsing in shockwave and publishing some movies on the internet, that all of them use the XML...
  3. #2

    Default Re: Problematic Postbacks

    Just a stab in the dark, here, but do you manually close your connection
    (the one for inserting/updating the data) before you rebind?

    David Wier
    [url]http://aspnet101.com[/url]
    [url]http://aspexpress.com[/url]


    "news.microsoft.com" <sjvanterpool@hlscc.edu.vg> wrote in message
    news:uZ$XcHPYDHA.2448@TK2MSFTNGP09.phx.gbl...
    > I do that, but it only shows up on the SECOND postback.
    > "Lim Siew Cheng" <siew_cheng555@yahoo.com> wrote in message
    > news:3f39165b$1@news.starhub.net.sg...
    > >
    > > this may be a stupid response,
    > > after updating the database, how about rebounding the label ?
    > >
    > >
    > >
    > > news.microsoft.com wrote:
    > > > 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.
    > > >
    > > >
    > > >
    > > >
    > >
    >
    >

    David Wier Guest

  4. #3

    Default Re: Problematic Postbacks

    I do that, but it only shows up on the SECOND postback.
    "Lim Siew Cheng" <siew_cheng555@yahoo.com> wrote in message
    news:3f39165b$1@news.starhub.net.sg...
    >
    > this may be a stupid response,
    > after updating the database, how about rebounding the label ?
    >
    >
    >
    > news.microsoft.com wrote:
    > > 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.
    > >
    > >
    > >
    > >
    >

    news.microsoft.com Guest

  5. #4

    Default Re: Problematic Postbacks

    Hello


    What is probably happening is that you ar referencing control values
    directly as in MyResult=MyLabel.Text. There is a latency between the
    control value on postback and the actual changed values. If you are using a
    control's value change to initiate the postback then getting the current
    value is easy...you use the 'SENDER' argument of the event to get the actual
    value:

    Sub MyText_Changed(sender as object, e as systeme.arguments)

    Dim CurrentText as TextBox = DirectCast(Sender, TextBox)

    End Sub

    In the case above, the CurrentText object has the currently changed value as
    opposed to MyText that latently holds the original value before the change.
    I am guessing that you are somehow repopulating the display with latent
    data. Not seeing your code it's hard to tell but your problem description
    fits that latency scenerio I described above.

    Ibrahim


    "news.microsoft.com" <sjvanterpool@hlscc.edu.vg> wrote in message
    news:uZ$XcHPYDHA.2448@TK2MSFTNGP09.phx.gbl...
    > I do that, but it only shows up on the SECOND postback.
    > "Lim Siew Cheng" <siew_cheng555@yahoo.com> wrote in message
    > news:3f39165b$1@news.starhub.net.sg...
    > >
    > > this may be a stupid response,
    > > after updating the database, how about rebounding the label ?
    > >
    > >
    > >
    > > news.microsoft.com wrote:
    > > > 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.
    > > >
    > > >
    > > >
    > > >
    > >
    >
    >

    IbrahimMalluf Guest

  6. #5

    Default Problematic Postbacks

    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 Guest

  7. #6

    Default Re: Problematic Postbacks

    Here's the code:

    private void buttonCurrent_Click(object sender, System.EventArgs e)

    {

    generalDataSet1.CurrentPoll.AddCurrentPollRow(int. Parse(this.DataGrid1.DataK
    eys[this.DataGrid1.SelectedIndex].ToString()),DateTime.Now);


    this.daCurrentPoll.Update(generalDataSet1);

    generalDataSet1.CurrentPoll.Clear();

    daCurrentPoll.Fill(generalDataSet1,"CurrentPoll");

    this.labelCurrentPoll.DataBind();

    }


    news.microsoft.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139