What is the difference between Page.IsPostBack and Page.IsCallBack?
Asked Answered
R

5

44

I've recently ran into some code that checks Page.IsCallBack but I wasn't sure how it is different from Page.IsPostBack. Can anyone enlighten me?

Edit: Are they mutually exclusive or can both occur at the same time in a given situation?

Rossini answered 17/4, 2009 at 15:33 Comment(1)
Given the answers so far, a better question might be what's the difference between IsCallback and IsAsync?Eudoxia
A
46

Page.IsCallBack

It is getting a value indicating whether the page request is the result of a call back. Its a special postback, so a round-trip always occurs; however, unlike the classic postback, the script callback doesn't redraw the whole page. ViewState is not updated during a callback, it is for postback.

Page.IsPostBack

Checks whether the Page is accessing the server for the first time or not. Unlike the IsCallBack, the ViewState is updated

Refer to Page Life Cycle for more detail that shows a diagram illustrating the sequence of events

Edit - To answer your new question

Page.IsPostback property will return true for both request types. The Page.IsCallback property will return true only when the request is a client callback

Autocade answered 17/4, 2009 at 15:35 Comment(2)
I like your answer but could you rephrase your 2nd quote so it is cleaner? Thanks.Rossini
Link now broken. Maybe should be edndoc.esri.com/arcobjects/9.2/NET_Server_Doc/developer/ADF/… ?Un
I
33

IsPostBack is true when the page is posted via a form method

IsCallBack is true when the page has been called back from an AJAX call.

Inconformity answered 17/4, 2009 at 15:36 Comment(0)
W
6

A callback is a special postback, so a round-trip always occurs; however, unlike the classic postback, the script callback doesn't redraw the whole page. ViewState is not updated during a callback, it is for postback.

More info here:

Willem answered 17/4, 2009 at 15:36 Comment(1)
In a callback, can you mainuplate the Response to return a file(like csv) for the user to download?Heavyweight
P
6

A postback is when the form is posted back to itself, either by clicking a submit button or through Javascript (like AutoPostback controls)

A callback is when an AJAX Control calls a method on the page as part of an ajax request

Previous answered 17/4, 2009 at 15:37 Comment(1)
Can you give some examples of relevant controls that would issue a callback?Rossini
S
0

Page.IsPostBack Checks whether the Page is accessing the server for the first time or not. Unlike the IsCallBack, the ViewState is updated

Spotty answered 4/2, 2015 at 15:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.