asp.net – WebForm_DoCallback定义

前端之家收集整理的这篇文章主要介绍了asp.net – WebForm_DoCallback定义前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
有关WebForm_DoCallback功能的MSDN的简单说明吗?

我可以找到的是这篇文章http://msdn.microsoft.com/en-us/magazine/cc163878.aspx
其中包括WebForm_DoCallback的实现,但是不能很好地解释参数本身.

function WebForm_DoCallback(eventTarget,eventArgument,eventCallback,context,errorCallback)

像什么是“eventTarget”呢?
什么是“上下文”?
等等…

解决方法

WebForm_DoCallback似乎是客户端对应的 GetCallbackEventReference.它生成与相同的参数,如下所示:

target: The name of a server Control that handles the client
callback. The control must implement
the ICallbackEventHandler interface
and provide a RaiseCallbackEvent
method.

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.

clientCallback和clientErrorCallback是客户端(通常是JavaScript)函数,参数的格式如下:

function clientCallback(returnmessage,context) {}

其中returnmessage是来自服务器的响应(或错误),上下文与之前传递的上下文相同.

参考文献:

MSDN: ClientScriptManager.GetCallbackEventReference Method

MSDN Magazine: Implications of Script Callbacks in ASP.NET

ESRI Developer Network: Page Postbacks and Client Callbacks

原文链接:https://www.f2er.com/aspnet/245502.html

猜你在找的asp.Net相关文章