通过标签加载页面时的处理状态

时间:2016-10-30 13:45:03

标签: c# asp.net

通过我的程序我处理大号没有。数据,所以我想在处理数据时显示状态 例如:-2记录已完成,等等

我的代码: -

asp.net:

<div class="loading" align="center">
    File Uploading. Please wait.<br />
    <br />
    <asp:Label ID="LblStatus" runat="server" Text=""></asp:Label>
</div>

Cs页面:

private void Process(int Rec)
{
    LblStatus.Text = "";
    for (int i = 0; i < Rec; i++)
    {
        ProcessData(i);
        LblStatus.Text = i.ToString() + " Records completed";
    }
}

我用于页面加载器的JS

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
    function ShowProgress() {
        setTimeout(function () {
            var modal = $('<div />');
            modal.addClass("modal");
            $('body').append(modal);
            var loading = $(".loading");
            loading.show();
            var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
            var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
            loading.css({ top: top, left: left });
        }, 200);
    }
    $('form').live("submit", function () {
        ShowProgress();
    });
</script>

0 个答案:

没有答案