博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
IsCallback和IsPostBack的区别
阅读量:5117 次
发布时间:2019-06-13

本文共 2101 字,大约阅读时间需要 7 分钟。

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.

 

原文:

转载于:https://www.cnblogs.com/jmax/archive/2010/12/28/1918752.html

你可能感兴趣的文章
Redis内存使用优化与存储
查看>>
一些技术文章
查看>>
android提示框
查看>>
一个小问题引发的思考
查看>>
WPF自学入门(十一)WPF MVVM模式Command命令
查看>>
Oracle篇 之 子查询
查看>>
zzuli 1907: 小火山的宝藏收益
查看>>
nodejs 中的一些方法
查看>>
R_Studio读取xls文件
查看>>
oralce中的dual详解 转 http://blog.sina.com.cn/s/blog_a5a24bcb0100zeay.html
查看>>
Android入门
查看>>
吃得菜根,百事可为。
查看>>
用ASP.NET MVC仿站糗事百科
查看>>
安装 ant
查看>>
344. Reverse String
查看>>
Windows及其他软件开发过程中一般都有哪些版本?
查看>>
strlen、strcpy、strcat的实现
查看>>
UIBezierPath
查看>>
查询Ubuntu版本号
查看>>
Devexpress中WebChartControl控件柱状统计图的做法(数据为调用存储过程)
查看>>