public partial class MyControl1 : System.Web.UI.UserControl,
ICallbackEventHandler
    {
        private string _result;
        public string GetCallbackResult()
        {
            return _result;
        }
        public void RaiseCallbackEvent(string eventArgument)
        {
            try
            {
                string[] inputData = eventArgument.Split('|');
                _result = Convert.ToString(int.Parse(inputData[0]) + int.Parse(inputData[1]));
            }
            catch
            {
                _result = "Nieprawidłowe dane!";
            }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ClientScriptManager cs = this.Page.ClientScript;
        string callBackFunction = cs.GetCallbackEventReference(this, "arg", "ClientCallbackHandler", "context");
        string clientFunction = "function AddValues(arg, context){ " + callBackFunction + "; }";
        cs.RegisterClientScriptBlock(this.GetType(), "AddValues", clientFunction, true);
    }
}
