怎样做程序“运行中”的提示? 一个从数据库读数据,然后写数据,数据量比较大。如何做一个判断程序运行的东西。做一个“运行中或运行的百分比之类的提示”。谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 读数据的操作用线程来实现;读了百分比你的线程知道,用事件通知到外面,外面收到事件后刷新UI(注意跨线程不能刷新UI控件) <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="upl" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:UpdateProgress ID="UpdateProgress1" runat="server"> <ProgressTemplate> <div> <div>数据加载中,请等待…… </div> </div> </ProgressTemplate> </asp:UpdateProgress> </asp:UpdatePanel> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID ="Button1" EventName ="Click" /> </Triggers> <ContentTemplate> <asp:Label ID="Label1" runat="server" Text="Label"> </asp:Label> </ContentTemplate> </asp:UpdatePanel> <asp:UpdateProgress ID="UpdateProgress1" runat="server"> <ProgressTemplate> <span style =" font-size:12px">数据更新中...... </span> </ProgressTemplate> </asp:UpdateProgress> <asp:Button ID="Button1" runat="server" Text="Button" Width="143px" OnClick="Button1_Click" /> 或使用div显示loading效果 <script language="javascript" type="text/javascript"> document.write(" <div id='loadDiv' style='padding-top: 250px; padding-left: 350px;font-size:x-large;height:400px'> <span id='loading'> <img src=\"../Images/loader2.gif\"/>正在加载数据,请稍候··· </span> </div>"); window.onload = function() { document.getElementById("hiddenDiv").style.display=""; document.getElementById("loadDiv").parentNode.removeChild(document.getElementById("loadDiv")); } </script> 不知对你是否有帮助:这是一个简单的 “运行中”提示的示例:http://blog.csdn.net/sxldfang/archive/2010/04/25/5527456.aspx 委托与事件的利弊 在自定义控件中继承ICallbackEventHandler 用C#调用 google v8的dll文件? 如何让程序指运行一个 如何为sql表中一个自增字段添加记录 webclient上传文件出错--操作超时。该如果解决呢,在线等...... e.Graphics.DrawString("this is font", this.Font, Brushes.Black, 100, 9); 【帮忙顶一下,有分】链接地址在里面! 关于 WPF 的 问题 怎么在load页面时把一个焦点传递到一个TextBox中? 新线程在多窗口中怎么使用? 发道c#面试题,反转数组......
读了百分比你的线程知道,用事件通知到外面,外面收到事件后刷新UI(注意跨线程不能刷新UI控件)
</asp:ScriptManager>
<asp:UpdatePanel ID="upl" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<div>
<div>数据加载中,请等待…… </div>
</div>
</ProgressTemplate>
</asp:UpdateProgress>
</asp:UpdatePanel> <asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID ="Button1" EventName ="Click" />
</Triggers>
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"> </asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<span style =" font-size:12px">数据更新中...... </span>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:Button ID="Button1" runat="server" Text="Button" Width="143px" OnClick="Button1_Click" />
或使用div显示loading效果
<script language="javascript" type="text/javascript">
document.write(" <div id='loadDiv' style='padding-top: 250px; padding-left: 350px;font-size:x-large;height:400px'> <span id='loading'> <img src=\"../Images/loader2.gif\"/>正在加载数据,请稍候··· </span> </div>");
window.onload = function()
{
document.getElementById("hiddenDiv").style.display="";
document.getElementById("loadDiv").parentNode.removeChild(document.getElementById("loadDiv"));
}
</script>