<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ClientCallback.aspx.cs" Inherits="ClientCallback"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/ xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtm l"> <head id="Head1" runat="server"> <title>Callback Test</title> <script type="text/javascript"> function ReceiveServerData(receivedStr, context) >
-------- ClientCallbacp.aspx.cs -----------
// ClientCallback.aspx.cs using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class ClientCallback : System.Web.UI.Page, System.Web.UI.ICallbackEventHandle r }
客户端用ReceiveServerData接收服务器返回的数据, <script type="text/javascript"> function ReceiveServerData(receivedStr, context) { alert(receivedStr); } </script>