The ICallbackEventHandler interface can be used to conveniently and efficiently implement Ajax functions. 1. The ICallbackEventHandler interface must be implemented for page processing. This interface has two methods: a and GetCallbackResult. The method returns the processing result to the client, after the request is complete, B and RaiseCallbackEvent are automatically called. This method is used to obtain data from the client and received by the eventArgument parameter, result 2 is obtained by performing relevant processing. register the callback and the master script a, and register the callback function string reference = Page. clientScript. getCallbackEventReference (this, "arg", "SendData", "context"); registers a reference to the callback function to obtain the returned results and perform business logic processing, the registered function name and the function name written by the client must be the same in order to reference B. register the main function, the main function, such as the string re request sent by the server. GCallbakeScript = "function CallServer (arg, context) {" + reference + "}"; Page. clientScript. registerClientScriptBlock (this. getType (), "CallServer", regCallbakeScript, true); c. Client Script: a callback function fucntion SendData (arg, context) {alert (arg );} call the CallServer function directly to send the request [csharp] server code [csharp] /// <summary> /// implement the ICallbackEventHandler interface, faster Ajax functions // </summary> public partial class _ Default: System. web. UI. page, IC AllbackEventHandler {private string returnValue = string. empty; protected void Page_Load (object sender, EventArgs e) {// register the callback script and write it by yourself. This script receives the returned result string reference = Page. clientScript. getCallbackEventReference (this, "arg", "SendData", "context"); // register the processing script string regCallbakeScript = "function CallServer (arg, context) {"+ reference +"} "; Page. clientScript. registerClientScriptBlock (this. getType ()," CallServer ", regCallbakeScript, true );} # region ICallbackEventHandler member // <summary> // return result /// </summary> /// <returns> </returns> public string GetCallbackResult () {if (string. isNullOrEmpty (returnValue) return (returnValue = "-1"); return returnValue;} // <summary> // triggers the RaiseCallbackEvent event to obtain client data, then process it. // </summary> /// <param name = "eventArgument"> </param> public void raisecallbackpa Ent (string eventArgument) {returnValue = eventArgument;} # endregion} [javascript] client script code: [javascript] <script type = "text/javascript"> // receives the callback result, this function is automatically called back after processing the server. It is equivalent to the callback function SendData (arg) {alert (arg);} in Ajax );} // client logic function GetReturnValue () {var arg = "Hello CallbackEventHandler! "; // Call the script registered after the page is loaded. Pass the parameter 'arg 'to the server for processing. The second parameter 'context' does not need to pass CallServer (arg ,"");} </script> <input type = "button" value = "CallbackMe" id = "btn" onclick = "GetReturnValue ()"/>