using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
namespace ICallBackEventHandlerSample
{
public partial class _Default : System.Web.UI.Page, ICallbackEventHandler
{
protected void Page_Load(object sender, EventArgs e)
{
ClientScriptManager scriptManager = Page.ClientScript;
String cbReference = scriptManager.GetCallbackEventReference
(this, "returnValue", "GetResult", "context");
String callbackScript = "function CallServer(returnValue, context)
{" + cbReference + "; }";
scriptManager.RegisterClientScriptBlock(this.GetType(),
"CallServer", callbackScript, true);
}
private string returnValue;
public string GetCallbackResult()
{
return returnValue;
}
public void RaiseCallbackEvent(string eventArgument)
{
returnValue = DateTime.Now.ToString();
}
}
}