This is a migrated thread and some comments may be shown as answers.

.ajaxrequest() method and PostBack

2 Answers 108 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
romulo~
Top achievements
Rank 1
romulo~ asked on 22 Dec 2015, 07:56 PM

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 Answers, 1 is accepted

Sort by
0
romulo~
Top achievements
Rank 1
answered on 23 Dec 2015, 12:16 PM

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.

0
Viktor Tachev
Telerik team
answered on 24 Dec 2015, 12:32 PM
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
Tags
Ajax
Asked by
romulo~
Top achievements
Rank 1
Answers by
romulo~
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or