Home     |      Learn AJAX     |      Forum     |      Register     |      Submit Resource     |      Submit Article      |      Contact Us

Home ASPNET
 

Better Ajax Behavior through CallBack

 

One of the struggles of web developers is the limited browser behavior. Once the page loads and starts to show its content with the client, communication to the server stops. If the server is not loading continuously, no new information is available unless new information is requested by the user. However, this triggers not only new information but the whole webpage will be loaded. In a very heavy website, users might find themselves struggling to update information of the webpage because of the loading time it requires to some things that are not even related to the webpage. One good example is video commercial in an HTML-based webpage.


This behavior is called a PostBack. Once the user requests for new information, it automatically connects to the server where it post back a webpage with the updated information. The PostBack function is not just composed of new information, the behavior reloads everything and users will have to wait before the new information is available.


Ajax answers this problem. This web development technique might not be the complete answer, but it addresses the PostBack concerns of developers. To be more specific, the answer is found in ASP.NET 2.0 – the version of ASP optimized for Ajax based experience.


ASP.Net introduces the callback function instead of a postback. In a callback function, specific parts of the webpage are the only ones that are reintroduced. The callback function uses XMLHTTP request to ensure that the asynchronous behavior, which is the continuous communication with the server, is assured.


Triggering XMLHTTP request is a good idea to reload the webpage while the server continues its work on the background. But the even better trick found in ASP.NET 2.0 is the callback function. With this function, developers will have the ability to reload the specific parts of the webpage – providing better experience as the end result.


To enable the callback function, ASP.NET 2.0 launches an interface called the ICallEventHandler. This interface triggers the function RaiseCallBack which endorses the specific information to the client. When RaiseCallBack function is triggered, server responds with another function which communicates directly to the server called the GetCallBackResult. Also located in the interface are the following functions:


GetCallbackEventReference – used by the interface to validate the communication of the ICallEventHander.


RegisterClientScriptBlock – provided by the interface so that it could record the transaction between the client and server for a possible bookmarking and back button interface.


These are only simple interactions provided by ASP.NET 2.0 but it has provided strides of convenience for the user. For developers it is just another day of work as they code the webpage for better functionality. The challenge is not really on coding but on what information should be streamed.


The end result of course is a better browser that provides more than just simple information but a real-time, and on demand information without the necessary reload of the whole webpage. Ajax may have baffled some web developers in the past, but with the use of frameworks such as ASP.NET 2.0, it certainly has made web development easier.



Read Next: Mainsoft Enables ASP.Net for Linux OS



 

 

Comments



Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links