Page.IsPostBack Vs Page.IsCallBack

In ASP.Net Page class provides 2 similar methods which indicate that the Page is posted back or not. In this article I have tried to explain the differences between
Page.IsPostBack & Page.IsCallBack

I have been into Web Development quite a long time and surprisingly, I never noticed that in ASP.Net Page class provides 2 similar methods which indicate that the Page is posted back or not. These methods are

Page.IsPostBack & Page.IsCallBack

Yesterday when I was looking into some previously implemented code then I saw the use of Page.IsCallBack. After looking this method, I start finding the use of this method. I am going to share the knowledge which I gathered while reading about Page.IsCallBack.

I hope everyone know about Page.IsPostBack which returns a boolean value indicating that the rendering page is due to some action performed on the page or it is the first time when the page is getting rendered.

The difference which I understood between both of these methods is Page.IsPostBack returns a boolean value which denotes whether the request initiated is accessing the Web Server for the first time or not. Whether it is a result of an action performed on some Server Control or the request is initiated directly from Url by calling it. Page.IsCallBack returns a boolean value which denotes that the request is an AJAX call or not. In other words we can say that Page.IsCallBack will be true when the request is Client Callback. If the request is an AJAX call then Page.IsCallBack will be returned as TRUE.

Page.IsPostBack update the ViewState while Page.IsCallBack does not.Page.IsPostBack redraw the whole page again while Page.IsCallBack redraw only the desired portion of the page.Page.IsPostBack will always be true when Page.IsCallBack is true but it is not necessary that Page.IsCallBack will always be true if Page.IsPostBack is true.

In case anyone want to know, if the request is Client Callback or not and If it is virgin request then we can use these two properties.

Comments

No responses found. Be the first to comment...

Notify me by email when others post comments to this article.

Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.