AJAX ASP.NETUnderstanding ASP.Net on Ajax is not rocket science but could be easily confusing because of the additional learning requirements. There are some key facts every developer should know regarding Ajax on ASP.Net to fully harness the framework and build the expected applications.
Specifically, it is very important for developers to know the key elements in the life cycle of Ajax ASP.Net so that the right functions should be used. Since functions have specific resource requirements in the life cycle, they should be understood so that other functions, data and variables could be effectively used.
The Two Classes
ASP.Net for Ajax uses two classes to deal with events: PageRequestManager and Application classes. These classes have specific functions and limitations but they complement each class to create a powerful application.
PageRequestManager, as the name suggests, loads the functions to the browser. Its main purpose is to load the needed content in the application which means its role ends as soon as the browser has complete control in the online application. Applications, on the other hand, have the same purpose but focuses on the scripts. Applications are also used to connect to the server for the needed data.
Key Events in ASP.Net
Aside from classes, there are events that developers have to harness in Ajax ASP.Net. These scripts are specifically for two forms of loading in Ajax: the partial and complete page load.
Partial page loading is a bit challenging in ASP.Net because it has to use UpdatePanel in the framework. Aside from the UpdatePanel, developers have to use the entire PageRequestManager class so that the right content will be loaded.
Complete page loading will only require developers to use the load function in the Application class. This is highly applicable for lighter applications because data and scripts can be loaded before they are accessed.
Controlling Handlers
Functions created by Applications and PageRequestManagers have to be edited by two methods: addeventname and removeeventname. These two functions can be used in both classes.
Instead of completely removing the functions, the two methods are recommended to avoid confusion in coding. Manually deleting the functions created by the classes can easily disrupt the process. Instead of going back to remove the functions manually, these methods are added to work with the functions created in classes.
Using the "Reserve" Functions
The applications object uses two functions to load the scripts: load and unload. These two functions are used so that scripts can be effectively loaded in the application. As already indicated, this may require complete loading in the application but very useful in lightweight applications.
But what if there are additional scripts to be loaded? There are two additional functions that can be used to complement the load and unload: pageLoad and pageUnload. This function can be compared to addeventname and removeeventname except it is specifically made for the Applications class.
These are the functions, classes and methods related to the life cycle of ASP.Net. These should aid developers effectively load their scripts and content for Ajax or JavaScript based applications.
| Comments |
|---|