使用 Sys WebForms PageRequestManager 进行异步交互

发布于 2024-07-20 07:10:47 字数 1034 浏览 5 评论 0 原文

我试图在进行异步调用时向用户显示一个面板,但前提是发生在特定调用中。

使用正常的“获取控制”脚本我有我的喜欢:

function pageLoad() {

    try {
        var manager = Sys.WebForms.PageRequestManager.getInstance();
        manager.add_endRequest(OnEndRequest);
        manager.add_beginRequest(OnBeginRequest);
    }
    catch (err) { }
}

function OnBeginRequest(sender, args) {
    //alert('Start\n\n' + sender + '\n\n' + args);
    var p = document.getElementById('ajaxLoadingPanel');
    p.style.visibility = 'visible';
    p.style.display = 'inline';
}

function OnEndRequest(sender, args) {
    //alert('End\n\n' + sender + '\n\n' + args); 
    var p = document.getElementById('ajaxLoadingPanel');
    p.style.visibility = 'hidden';
    p.style.display = 'none';
}  

但我的问题是我如何知道发送者和args的方法?

我去了通过MSDN,他们没有谈论我们可以使用的方法,并且VS2008中没有这部分的智能...

有任何想法吗? 我想要获取可以使用此 javascript API 的发送者和参数的方法和属性列表。

I'm trying to display a panel to the user when an asynchronous call is made, but only if that happend from a specific call.

using the normal "get control" script I have mine like:

function pageLoad() {

    try {
        var manager = Sys.WebForms.PageRequestManager.getInstance();
        manager.add_endRequest(OnEndRequest);
        manager.add_beginRequest(OnBeginRequest);
    }
    catch (err) { }
}

function OnBeginRequest(sender, args) {
    //alert('Start\n\n' + sender + '\n\n' + args);
    var p = document.getElementById('ajaxLoadingPanel');
    p.style.visibility = 'visible';
    p.style.display = 'inline';
}

function OnEndRequest(sender, args) {
    //alert('End\n\n' + sender + '\n\n' + args); 
    var p = document.getElementById('ajaxLoadingPanel');
    p.style.visibility = 'hidden';
    p.style.display = 'none';
}  

but my question is How do I know the methods of sender and args?

I went through the MSDN and they talk nothing about the methods we can use, and there is no intellisence in VS2008 for this part...

any ideas? I want to get a list of methods and properties for both sender and args that I can use of this javascript API.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

杀お生予夺 2024-07-27 07:10:47

该文档很有帮助:
http://msdn.microsoft.com/en-us/library/bb398976。 aspx

它有一个表格,其中包含 PageRequestManager 上的所有事件及其事件参数。 然后事件参数记录它们的属性等。发送者始终是 PageRequestManager。

This documentation is helpful:
http://msdn.microsoft.com/en-us/library/bb398976.aspx

It has a table of all the events on PageRequestManager and what their event args are. Then the event args documents their properties, etc. The sender is always the PageRequestManager.

未央 2024-07-27 07:10:47

在ScriptDebugger中调试并找出sender和args的内容
您可以识别哪个控件导致了回发

Debug in ScriptDebugger and find out the contents of sender and args
you can identify that which control has caused the postback

柠檬色的秋千 2024-07-27 07:10:47

要了解哪个元素导致回发,可以使用 args.get_postBackElement().id。

To know which element caused postback, you can use args.get_postBackElement().id.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文