.ajaxrequest() method and PostBack

3 posts, 0 answers
  1. romulo~
    romulo~ avatar
    23 posts
    Member since:
    Nov 2012

    Posted 22 Dec 2015 Link to this post

    Hello,

     I'm having a problem but I actually don't know if it is really a problem or if it is normal behavior.

    Let's consider this:

    I have a form that loads data from DB. I check IsPostBack before loading data soi dont load everything when changing the values on some controls.

    When I save (a button click, and a postback) the data is all saved, and that postback didnt pass the load method, so no DB access on that life cycle part.

    I guess it is ok, right?

    The problem is when:

    - Before i'm validating data then i ask the user something. If he confirms, then I send the .ajaxrequest() (client-side method from the AjaxManager I put on the page) and this goes for the Load method of the life cycle, and in the method, the IsPostback is false, so it access the DB.

     

    The strange thing is:

    Lets say on the first load (from DB) the name field was "Rob".

    I changed it to "Berta" then tried saving

    I was asked something then confirmed.

    It entered the DB loading and brought me "Rob"

    but then when the saving continued (I'm calling it from the ajaxManager serverside event that catches the client ajaxrequest method) it is "Bertha" that I entered.

     

    I don't know if it is normal behavior or if I'm doing wrong for checking the IsPostback property. I'm kinda new to this ajax thing and this is making me a little confused.

     

    Thanks in advance for any help

  2. romulo~
    romulo~ avatar
    23 posts
    Member since:
    Nov 2012

    Posted 23 Dec 2015 Link to this post

    I found out what was wrong.

    In another part of the code, in a base class, the AsyncPostBackTimeout was being set when in debug, commenting that made everything work fine.

     

    Also I opened another project to test the behavior to see if I had the same results I said earlier and that didn't happen.

    So I guess everything is fine.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 24 Dec 2015 Link to this post

    Hi Romulo,

    Thank you for sharing your solution with the community. This can be helpful to someone observing similar behavior.

    Regards,
    Viktor Tachev
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top