知道适合我的 ASP.net 应用程序的良好页面加载进度条吗?

发布于 2024-07-07 09:31:43 字数 216 浏览 6 评论 0原文

只是想知道是否有人见过 C# .net 应用程序的任何可用进度条。 我的应用程序需要大约 20-60 秒才能加载,我很乐意在用户等待时向他们显示进度条。 我看到 这个 但示例网站似乎无法正常工作不能激发信心。

Just wondering if anyone has seen any usable progress bar for C# .net apps. My app takes about 20-60 secs to load and I would love to show users a progress bar while they wait. I saw this one but the sample site doesn't seem to work which doesn't inspire confidence.

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

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

发布评论

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

评论(3

动次打次papapa 2024-07-14 09:31:43

您可以使用 AJAX UpdateProgress 控件

<asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:UpdateProgress runat="server" id="PageUpdateProgress">
        <ProgressTemplate>
            Loading...
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel runat="server" id="Panel">
        <ContentTemplate>
            <asp:Button runat="server" id="UpdateButton" onclick="UpdateButton_Click" text="Update" />
        </ContentTemplate>
    </asp:UpdatePanel>

如果您想要动画,您所需要做的就是将动画 .gif 弹出到“ProgressTemplate”中。

You can use the AJAX UpdateProgress control.

<asp:ScriptManager ID="ScriptManager1" runat="server" />
    <asp:UpdateProgress runat="server" id="PageUpdateProgress">
        <ProgressTemplate>
            Loading...
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel runat="server" id="Panel">
        <ContentTemplate>
            <asp:Button runat="server" id="UpdateButton" onclick="UpdateButton_Click" text="Update" />
        </ContentTemplate>
    </asp:UpdatePanel>

If you want animation, all you need to do is pop an animated .gif into the 'ProgressTemplate'.

⒈起吃苦の倖褔 2024-07-14 09:31:43

我会研究这篇博客文章 - 似乎是一个好方法。 我自己还没有测试过...

http://mattberseth.com/blog/ 2008/05/aspnet_ajax_progress_bar_contr.html

I would look into this blog post - seems like a good way to do it. I haven't tested it myself...

http://mattberseth.com/blog/2008/05/aspnet_ajax_progress_bar_contr.html

笨死的猪 2024-07-14 09:31:43

在aspx页面中,您需要编写此内容,我添加了您自己需要定义的某些CSS类,从功能上讲,这段代码将帮助您

<asp:Panel ID="ProgressIndicatorPanel" runat="server" Style="display: none" CssClass="modalPopup">
        <div id="ProgressDiv" class="progressStyle">
            <ul class="ProgressStyleTable" style="list-style:none;height:60px">
                <li style="position:static;float:left;margin-top:0.5em;margin-left:0.5em">
                    <asp:Image ID="ProgressImage" runat="server" SkinID="ProgressImage" />
                </li>
                <li style="position:static;float:left;margin-top:0.5em;margin-left:0.5em;margin-right:0.5em">
                    <span id="ProgressTextTableCell"> Loading, please wait... </span>
                </li>
            </ul>
        </div>
    </asp:Panel>

定义一个函数,如ProgressIndicator,如下所示

var ProgressIndicator = function (progPrefix) {
    var divId = 'ProgressDiv';
    var textId = 'ProgressTextTableCell';
    var progressCss = "progressStyle";

    if (progPrefix != null) {
        divId = progPrefix + divId;
        textId = progPrefix + textId;
    }

    this.Start = function (textString) {
        if (textString) {
            $('#' + textId).text(textString);
        }
        else {
            $('#' + textId).text('Loading, please wait...');
        }
        this.Center();
        //$('#' + divId).show();
        var modalPopupBehavior = $find('ProgressModalPopupBehaviour');
        if (modalPopupBehavior != null) modalPopupBehavior.show();
    }

    this.Center = function () {
        var viewportWidth = jQuery(window).width();
        var viewportHeight = jQuery(window).height();
        var progressDiv = $("#" + divId);
        var elWidth = progressDiv.width();
        var elHeight = progressDiv.height();
        progressDiv.css({ top: ((viewportHeight / 2) - (elHeight / 2)) + $(window).scrollTop(),
            left: ((viewportWidth / 2) - (elWidth / 2)) + $(window).scrollLeft(), visibility: 'visible'
        });
    }

    this.Stop = function () {
        //$("#" + divId).hide();
        var modalPopupBehavior = $find('ProgressModalPopupBehaviour');
        if (modalPopupBehavior != null) modalPopupBehavior.hide();
    }
};

给出的示例包含一个带有Modal的进度指示器,即:当进度指示器正在运行,它会禁用屏幕上执行的其他操作。如果不需要,可以删除模态部分。

In aspx page you need to write this,I have added certain CSS class which you yourself need to define, functinality wise this code will help you

<asp:Panel ID="ProgressIndicatorPanel" runat="server" Style="display: none" CssClass="modalPopup">
        <div id="ProgressDiv" class="progressStyle">
            <ul class="ProgressStyleTable" style="list-style:none;height:60px">
                <li style="position:static;float:left;margin-top:0.5em;margin-left:0.5em">
                    <asp:Image ID="ProgressImage" runat="server" SkinID="ProgressImage" />
                </li>
                <li style="position:static;float:left;margin-top:0.5em;margin-left:0.5em;margin-right:0.5em">
                    <span id="ProgressTextTableCell"> Loading, please wait... </span>
                </li>
            </ul>
        </div>
    </asp:Panel>

Define a function say ProgressIndicator as follows

var ProgressIndicator = function (progPrefix) {
    var divId = 'ProgressDiv';
    var textId = 'ProgressTextTableCell';
    var progressCss = "progressStyle";

    if (progPrefix != null) {
        divId = progPrefix + divId;
        textId = progPrefix + textId;
    }

    this.Start = function (textString) {
        if (textString) {
            $('#' + textId).text(textString);
        }
        else {
            $('#' + textId).text('Loading, please wait...');
        }
        this.Center();
        //$('#' + divId).show();
        var modalPopupBehavior = $find('ProgressModalPopupBehaviour');
        if (modalPopupBehavior != null) modalPopupBehavior.show();
    }

    this.Center = function () {
        var viewportWidth = jQuery(window).width();
        var viewportHeight = jQuery(window).height();
        var progressDiv = $("#" + divId);
        var elWidth = progressDiv.width();
        var elHeight = progressDiv.height();
        progressDiv.css({ top: ((viewportHeight / 2) - (elHeight / 2)) + $(window).scrollTop(),
            left: ((viewportWidth / 2) - (elWidth / 2)) + $(window).scrollLeft(), visibility: 'visible'
        });
    }

    this.Stop = function () {
        //$("#" + divId).hide();
        var modalPopupBehavior = $find('ProgressModalPopupBehaviour');
        if (modalPopupBehavior != null) modalPopupBehavior.hide();
    }
};

The example given conatins a Progress Indicator with Modal ,i:e when progress Indicator is running it disables other operations to be performed on the screen.You can remove the Modal part if you doesnt need it .

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