1.首先繼承 ICallbackEventHandler
2.在Page_Load 裡面
ClientScriptManager scriptManager = this.Page.ClientScript;
string eventRef = scriptManager.GetCallbackEventReference(this, "argVal", "OnCallComplete", "ctxVal", "OnErrorOccurs", true);
3.Server:
/// <summary>
/// 接受客戶端的參數 進行運算
/// </summary>
/// <param name="eventArgument"></param>
public void RaiseCallbackEvent(string eventArgument)
{
strCallResult = voidtt();
}
/// <summary>
/// 返回CallBack的結果
/// </summary>
/// <returns></returns>
public string GetCallbackResult()
{
return strCallResult;
}
4.For Example: