zoukankan      html  css  js  c++  java
  • IsCallback和IsPostBack的区别

    What is the difference between a callback and a postback?

     
    A callback is a special postback, so a round-trip always occurs; however, unlike the classic postback, the script callback doesn't redraw the whole page. ViewState is not updated during a callback, it is for postback.
     
    How to make a callback?
     
    In the client side JavaScript code, if GetCallbackEventReference() method is reference, then when the JavaScript code is executed, a channel to the server is opened and an HTTP request is sent to the remote ASP.NET page.
     
    How does the ASP.NET runtime know this HTTP request is a Callback rather than a Postback?
     
    After the ASP.NET runtime get a HTTP request, it looks for a __CALLBACKID entry in the Request collection. If such an entry is found, the runtime concludes that a callback invocation is being made.
     
    GetCallbackEventReference() syntax
     
    public string GetCallbackEventReference (
    string target,      
        string argument,     
    string clientCallback,      
        string context,
        string clientErrorCallback,
        bool useAsync
    )
     
    there are overloads such as
    ClientScriptManager.GetCallbackEventReference (Control, String, String, String)
    ClientScriptManager.GetCallbackEventReference (Control, String, String, String, Boolean)
     
    GetCallbackEventReference() Parameters
     
    target
    The name of a server Control that handles the client callback. The control must implement the ICallbackEventHandler interface and provide a RaiseCallbackEvent method (which could be the page itself).
    argument
    An argument passed from the client script to the server RaiseCallbackEvent method.
    clientCallback
    The name of the client event handler that receives the result of the successful server event.
    context
    Client script that is evaluated on the client prior to initiating the callback. The result of the script is passed back to the client event handler.
    clientErrorCallback
    The name of the client event handler that receives the result when an error occurs in the server event handler.
    useAsync
    true to perform the callback asynchronously; false to perform the callback synchronously.

    原文:http://geekswithblogs.net/AaronLi/archive/2007/04/20/111817.aspx

  • 相关阅读:
    RabbitMQ安装(发生系统错误5。拒绝访问。发生系统错误1067。进程意外终止。)
    SQLServer执行脚本提示“系统找不到指定的文件”或“内存资源不足”
    TypeScript@HelloWorld!
    超详细Node安装教程
    进制转换
    菜鸟成长记
    ASP.NET Core中使用MialKit实现邮件发送
    VS未能正确加载 ”Microsoft.VisualStudio.Editor.Implementation.EditorPackate“包错误解决方法
    C#Winfrom Listview数据导入Excel
    安装研发服务器
  • 原文地址:https://www.cnblogs.com/jmax/p/1918752.html
Copyright © 2011-2022 走看看