用ICallbackEventHandler接口 实现无刷新回传
成功代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="testClientCallBack.aspx.cs" Inherits="testClientCallBack" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script type="text/javascript">
function CallServer()
{
var product = "test";
<%= ClientScript.GetCallbackEventReference(this, "product", "ReceiveServerData",null)%>;
}
function ReceiveServerData(rValue)
{
//alert(rValue[0]+'/'+rValue[1]+'/'+rValue[2]+'/');
alert(rValue);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<button onclick="CallServer()">CallServer</button>
</div>
</form>
</body>
</html>
----------------------
private string CallBackValue = string.Empty;
string ICallbackEventHandler.GetCallbackResult()
{
string a1 = "test";
return CallBackValue + ",ok";
// return a1;
}
void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
this.CallBackValue = eventArgument;
}
现在想返回一个数组
string[] ICallbackEventHandler.GetCallbackResult()
{
string[] a1 = new string[]{"a","b","c"};
//return CallBackValue + ",ok";
return a1;
}
报错
讲
“ICallbackEventHandler.GetCallbackResult”不是接口成员