显示 Web 服务调用的微调器(如 UpdateProgress Control)

发布于 2024-07-13 08:33:39 字数 218 浏览 2 评论 0原文

现在,我有一个页面,不幸的是,其中混合了更新面板和从 javascript 调用 webservice web/script 方法。

我有一个更新进度控件,它显示更新面板活动的微调器。 但是当我进行网络服务调用时,它不会显示。

由于用户体验需要一致,您建议我如何解决这个可用性问题。 我是否应该挂钩每个 Web 服务调用来隐藏和显示 updatecontrol 的 div?

Right now, I have a page where unfortunately there is a mix of update panels and calls to webservice web/script methods from javascript.

I have an update progress control which shows a spinner for update panel activity. But when I do webservice calls it isn't displayed.

How would you recommend I solve this usability issue since the user experience needs to be consistent. Should I hook into each webservice call to hide and show the updatecontrol's div?

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

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

发布评论

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

评论(1

泅渡 2024-07-20 08:33:39

好吧,对于初始页面呈现和同步回发,UpdateProgress 控件不是显示。 因此,请确保您的 UpdatePanel 正在异步更新。

此外,在链接页面的底部,它显示了控制微调器何时显示所需的内容。

话虽如此,这是微软解决您的问题的黄金途径。 ASP.NET Ajax 库中的某个位置可能存在错误,导致旋转器无法显示。

如果您确实用尽了所有选项,请尝试自己做。 如果您重写 beginRequest 和 endRequest JavaScript 方法,则可以控制微调器何时显示。 我可能会将这些函数中的任何先前代码保存到如下变量中:

function addLoadEvent(func)
{
    var oldonload = window.onload;
    if(typeof window.onload != 'function')
    {
        window.onload = func;
    }
    else
    {
        window.onload = function()
        {
            oldonload();
            func();
        }
    }
}

现在,当然,此代码用于向 window.onload 添加新函数,但相同的技术也适用于 beginRequest 和 endRequest。

希望这可以帮助

Well, for initial page rendering and for synchronous postbacks, the UpdateProgress control is not displayed. So, make sure that your UpdatePanel is updating asynchronously.

Also, at the bottom of the linked page, it shows what you must have in order to control when the spinner will show up.

Having said that, this is the Microsoft's golden path to the resolution of your problem. It could be possible that there's a bug somewhere in the ASP.NET Ajax library that's preventing the spinner from showing.

If you do exhaust all the options, try doing it yourself. If you override the beginRequest and endRequest JavaScript methods, you can control when the spinner shows up. I'd probably save any previous code in those functions to variables like this:

function addLoadEvent(func)
{
    var oldonload = window.onload;
    if(typeof window.onload != 'function')
    {
        window.onload = func;
    }
    else
    {
        window.onload = function()
        {
            oldonload();
            func();
        }
    }
}

Now, granted, this code is for adding a new function to window.onload, but the same technique can work for beginRequest and endRequest.

Hope this helps

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