⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 callbackexample.aspx.cs

📁 Introduce AJAX, can learn more thing.
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class CallbackExample : System.Web.UI.Page, ICallbackEventHandler
{
    string callbackResult;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsCallback)
            return;

        string callBackFunctionCall = ClientScript.GetCallbackEventReference(this, "getSelectedItemID()", "onCallbackComplete", null, "onCallbackError", true);
        Page.ClientScript.RegisterClientScriptBlock(GetType(), "CallBack", "function DoClientCallBack() { " + callBackFunctionCall + "} ", true);
    }

    #region ICallbackEventHandler Members

    public string GetCallbackResult()
    {
        return callbackResult;
    }

    public void RaiseCallbackEvent(string eventArgument)
    {
        try
        {
            callbackResult = Warehouse.GetItemQuantity(eventArgument).ToString();
        }
        catch (Exception e)
        {
            Trace.Write(e.Message);
            throw new Exception("Error checking quantity");
        }
    }

    #endregion
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -