Four Ways to Locally Update a Web Page
page 6 of 12
by Xianzhong Zhu
Average Rating: 
Views (Total / Last 10 Days): 49175/ 65

Callback in ASP.NET 2.0

One of the most attractive features that ASP.NET 2.0 has contributed to the web development field is the script callback, which allows you to make a server-side call from the client side without posting back to the server. In essence, the client-side script callback utilizes the XmlHttp component implemented by most of the up-to-date web browsers to set up communication with the server side. The following Figure describes the rough mechanism of the client-side script callback inside ASP.NET 2.0 architecture.

Figure 5: Mechanism of the ASP.NET 2.0 client-side script callback

As depicted by the above figure, performing a client callback involves the following steps:

1. Call the page's GetCallbackEventReference method to get the name of a client-side function that will be called to initiate a callback. (Note that the GetCallbackEventReference method is declared in the ICallbackEventHandler namespace, and thus your server-side controls must explicitly implement that interface ; and accordingly, your client-side JavaScript has to explicitly call ClientScript.GetCallbackEventReference() method.)  Then, that function is called from the client side.

2. That function prompts ASP.NET's callback manager, which is itself implemented in client-side script, to launch an XMLHTTP callback to the server.

3. On the server side, ASP.NET receives the call and invokes the page's ICallbackEventHandler.RaiseCallbackEvent() method, which processes and returns the callback.

4. The callback manager is notified that the execution has completed.

5. The callback manager notifies the caller that the call was completed by calling a client-side notification function (provided by the caller when it initiated the call).

In the next section, we are to create a sample to demonstrate ASP.NET 2.0's script callback feature, by which we are also to achieve in partially updating a web page.

View Entire Article

User Comments

Title: d   
Name: d
Date: 2012-10-24 12:04:07 PM
Title: Locally update a web page   
Name: Santosh
Date: 2010-05-04 3:41:59 AM
It's an amazing and really very very helpful article. After reading this article, I have become a fan of this site.... I request you to not delete this article, as it may be very helpful to many people.
Title: updating a web page   
Name: Mrs.
Date: 2009-05-19 3:23:22 PM
this is great
Title: Download Links Does Not Work   
Name: Tarik
Date: 2008-11-07 9:04:04 AM
Good Article , But Please Review The Downloads Links
Title: Mr.   
Name: Joydip Kanjilal
Date: 2008-10-16 10:25:58 AM
Title: how up date webpage   
Date: 2008-09-08 10:32:32 PM

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-07-23 1:19:42 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search