扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:builder.com.cn 2007年2月12日
关键字:
<%@ Page Language="C#" %>
<%@ Implements Interface="System.Web.UI.ICallbackEventHandler" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html><head>
<title>ASP.NET Callback</title>
<script language="C#" runat="server">
void Page_Load(object sender, EventArgs e) {
String callbackRef;
String callbackScript;
callbackRef= Page.ClientScript.GetCallbackEventReference(this,"arg","GetData","");
callbackScript = "function CallServer(arg, context) {" + callbackRef + "; }";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true);
}
public string GetCallbackResult() {
return "The current time is: " + DateNow.ToString();
}
public void RaiseCallbackEvent(String eventArgument) {
}
</script>
<script type="text/javascript">
function GetData(arg, context) {
Results.innerText = '';
}
</script></head><body>
<form id="frmCallback" name="frmCallback" runat="server">
<input type="button" value="Callback" onclick="CallServer(1, Results.innerText = 'Callback')"/>
<br><span id="Results"></span>
</form></body></html>
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。