aspx页面等待指示器的多线程C#

aspx页面等待指示器的多线程C#,c#,asp.net,multithreading,C#,Asp.net,Multithreading,我试图在我的aspx页面上表明它正在处理请求。也许这不是最好的方法。但我似乎找不到另一种方法来让它发挥作用。我希望我想做的有意义。我感谢任何帮助和建议 无论如何,以下是ASPX代码: <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="content"> <style type="text/css"> #UpdatePanel1, #UpdatePanel2, #UpdateProgre

我试图在我的aspx页面上表明它正在处理请求。也许这不是最好的方法。但我似乎找不到另一种方法来让它发挥作用。我希望我想做的有意义。我感谢任何帮助和建议

无论如何,以下是ASPX代码:

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="content">

<style type="text/css">
    #UpdatePanel1, #UpdatePanel2, #UpdateProgress1 { 
        border-right: gray 1px solid; border-top: gray 1px solid; 
        border-left: gray 1px solid; border-bottom: gray 1px solid;
    }
    #UpdatePanel1, #UpdatePanel2 { 
        width:200px; height:200px; position: relative;
        float: left; margin-left: 10px; margin-top: 10px;
    }
    #UpdateProgress1 {
        width: 400px; background-color: #FFC080; 
        bottom: 0%; left: 0px; position: absolute;
    }
</style>
    <div>
        <asp:ScriptManager ID="ScriptManager2" runat="server" />
        <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
            <ContentTemplate>
                <%=DateTime.Now.ToString(CultureInfo.InvariantCulture) %> <br /> 
            </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                Archiving...
            </ProgressTemplate>
        </asp:UpdateProgress>
    </div>

<table cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <ul>
                <li>
                    <span>
                        <asp:ImageButton ID="ArchiveImageButton" runat="server" AlternateText="Archive Compliance"
                            ImageUrl="~/images/Icons/24/452-bank.gif" OnClick="Button_Click" ToolTip="Archive compliance results" />
                    </span>

                </li>
            </ul>
        </td>
    </tr>

出于您的目的,使用JavaScript显示覆盖似乎更容易。下面是代码,这是一个要演示的JSFIDLE

<script type="text/javascript">
    showOverlay = function(){
        var overlay = document.getElementById("overlay");
        if (overlay){
            overlay.style.display = "block";
        }
    }     
</script>
<asp:Button ID="Button1" runat="server" Text="Submit" OnClientClick="showOverlay();" />
<div id="overlay">
    <div id="wait-dialog">Please wait while the form processes...</div>
</div>

出于您的目的,使用JavaScript显示覆盖似乎更容易。下面是代码,这是一个要演示的JSFIDLE

<script type="text/javascript">
    showOverlay = function(){
        var overlay = document.getElementById("overlay");
        if (overlay){
            overlay.style.display = "block";
        }
    }     
</script>
<asp:Button ID="Button1" runat="server" Text="Submit" OnClientClick="showOverlay();" />
<div id="overlay">
    <div id="wait-dialog">Please wait while the form processes...</div>
</div>

这取决于您使用的.Net版本,是哪个?取决于您使用的.Net版本,是哪一个?但是,当代码隐藏方法完成处理时,是什么中断了它?当回发发生时,它将自行消失。但是,当代码隐藏方法完成处理时,是什么中断了它?当回发发生时,它将自行消失。
#overlay {
    display: none;
    position: absolute;
    left: 0;
    top: 0;
    background-color: #666;
    width: 100%;
    height: 100%;
    z-index: 100;
}
div#wait-dialog {
    margin: 0px auto;
    padding: 20px;
    text-align:center;
    width: 400px;
    min-height: 200px;
    background-color: #ccc;
}