Connecting Tech Pros Worldwide Help | Site Map

What is the difference between PostBack & Callback? Please give sample code?

Newbie
 
Join Date: Jul 2008
Posts: 17
#1: 4 Weeks Ago
Folks!

What is the difference between PostBack and Callback ( !IsPostBack and if(!IsCallback))

Like in the following Code Snippet:
Expand|Select|Wrap|Line Numbers
  1.         protected void Page_Load(object sender, EventArgs e)
  2.         {           
  3.             if (!IsPostBack)
  4.             {
  5.  
  6.             }
  7.  
  8.             if(!IsCallback)
  9.             {
  10.  
  11.             }
  12.         }


As far as I know, when I 1) refresh the page or 2) revert back to the page after round trip, the behavior is such that IsPostBack = !IsCallback. I don't find any difference.

Can you please explain with example code?

Just want a sample code (for Page_Load event) that will demonstrate the difference in the Page_Load event so that I can toggle breakpoint and understand it for myself.

Thanks.
best answer - posted by PRR
A Postback occurs when the data (the whole page) on the page is posted from the client to the server.During a page postback, the Web page and controls are recreated and a new version of the entire Web page is rendered on the client.

Callback is also a special kind of postback, but it is just a quick round-trip to the server to get a small set of data.
Link

Determine How ASP.NET Web Pages Were Invoked
Page.IsPostBack
Page.IsCallback
PRR PRR is offline
Moderator
 
Join Date: Dec 2007
Location: India
Posts: 700
#2: 3 Weeks Ago

re: What is the difference between PostBack & Callback? Please give sample code?


A Postback occurs when the data (the whole page) on the page is posted from the client to the server.During a page postback, the Web page and controls are recreated and a new version of the entire Web page is rendered on the client.

Callback is also a special kind of postback, but it is just a quick round-trip to the server to get a small set of data.
Link

Determine How ASP.NET Web Pages Were Invoked
Page.IsPostBack
Page.IsCallback
Newbie
 
Join Date: Jul 2008
Posts: 17
#3: 2 Weeks Ago

re: What is the difference between PostBack & Callback? Please give sample code?


Thanks for the reply!
Reply