ASP.NET2.0 - ICallbackEventHandler(2) 无刷新回调创建步骤
-
<body>
<form id="form1" runat="server">
<div>
<button onclick="CallServer()">CallServer</button>
</div>
</form>
</body>
-
<script language="javascript" type="text/javascript">
function CallServer()
{
var product = "test";
<%= ClientScript.GetCallbackEventReference(this, "product", "ReceiveServerData",null)%>;
}
function ReceiveServerData(rValue)
{
alert(rValue);
}
</script>
-
private string CallBackValue = string.Empty;
string ICallbackEventHandler.GetCallbackResult()
{
return CallBackValue + ",Light the passion Share the dream";
}
void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
this.CallBackValue = eventArgument;
}