Most of the time, we only need to use some simple Ajax functions to provide some simple callbacks without fancy things. However, many of the existing Ajax libraries are very large. Although there are many functions, we don't need them at all in many cases. I have encountered such experiences, so I want to get a very simple Ajax callback function. First of all, I think of ajaxmanager in CS. I just want to simplify it and remove unnecessary and many methods that are more suitable for our habits.
I named him ajaxlite, because he only needs two classes to implement Ajax functions. In order to not include JS files separately, I embedded JS into the DLL. A total of two files, one JS, one CS file, and two classes. This is the simplest Ajax class library I have ever seen. You just need to reference the compiled DLL file to your project and then register your user control or page in the page_load event,CodeIt is also very simple.
1. Register: Find the method that contains the ajaxmethod attribute label in the current control and register it with the client;
2. Post: the method that contains the ajaxmethod attribute label in the client-returned type and callback function lookup control is executed and returned;
3. Render: register to the prerender in the page lifecycle, and then render and execute js to implement callback.
Source codeProject (vs2008 beta1): ajaxlite
Bytes -----------------------------------------------------------------------------------------
[2007-10-11]Fixed a bug: when there are multiple ajaxmethod annotation methods, a script error occurs (less than one !).