上传文件时间比较长,期间想显示一个GIF进度条图片,求详细的解决办法。
AJAX和JS都试过了,由于没找到详细的办法,都没成功,请把代码贴全一点谢谢。
AJAX和JS都试过了,由于没找到详细的办法,都没成功,请把代码贴全一点谢谢。
解决方案 »
- 怎样实现以不同权限登录
- 求关于select的一个查询并判断的sql语句
- 如何在DataGrid的空模板中设置两对<tr></tr>标签?
- 为什么mySpace和MSDN在线WEB系统不用LINUX真是太慢了
- 如何控制在文本框中只输入数字,在线等
- 中奖了验证码88888,马上买彩票去,呵呵,顺便放点分
- 什么是接口,接口跟类有什么区别?
- 请教高手一个简单问题!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 倾囊分数:怎样计算IE的页码,并使一段文字位于页面的下方
- 在dategrig里有两个字段,请问第一个字段左对齐,第二个字段右对齐怎么实现呀?
- 类似QQ空间更换皮肤的功能怎么实现asp.net,请问大家谁有呢急急
- ASP.NET 前台与后台交互
jQuery progressBar 做文件上传的进度条
HTML code <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Sync.aspx.cs" Inherits="System_Sync_Sync" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>test </title> <style type="text/css"> <!-- .STYLE1{ color: #FF0000; font-weight: bold; } .STYLE2{ color: #848484; font-weight: bold; } .style3{ color:#ff0000; font-size:14px; font-weight:bold; } #show_box{ border:#f9761b 2px solid; width:378px; background-color:#f3f3f3; position:absolute; left:50%; top:50%; margin:-120px 0 0 -200px; } .close{ background-color:#f3f3f3; width:378px; line-height:28px; } .z{ margin:auto; width:278px; } .tt{ font-size:12px; color:#848484; border-bottom:#CCCCCC 1px solid; line-height:24px; } --> </style> </head> <body> <form id="form1" runat="server"> <asp:Panel ID="p1" runat="server"> <div id="show_box" style="display:none;"> <div class="close"> <div align="right"> </div> </div> <div class="z"> <table border="0" cellpadding="0" cellspacing="0" style="width: 100%; height: 200"> <tr> <td valign="middle" align="center"> <img src="../../Images/pic1.gif" /> 正在操作,请耐心等候... <br /> <br /> <img src="../../Images/load.gif" /> </td> </tr> </table> </div> </div> </asp:Panel> <table id="maintb" style="width: 100%;" class="content"> <tr> <td style="padding-left: 20px; padding-top:20px;"> <asp:Button ID="btnTest" runat="server" Text="测试" OnClick="btnTest_Click" OnClientClick="showBox();" /> <br /> </td> </tr> </table> </form> <script language="javascript" type="text/javascript"> function showBox(){ document.getElementById("show_box").style.display = "block"; document.body.style.backgroundColor="#666666"; } function initStyle() { document.body.style.backgroundColor="#FFFFFF"; } initStyle(); </script> </body> </html> [code=C#] using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using BLL; using Common; using Model; public partial class System_Sync_Sync : Page { //SyncBLL syncBll = new SyncBLL(); protected void Page_Load(object sender, EventArgs e) { p1.Visible = true; } private void doTest() { int returnValue = 0; try { //returnValue = syncBll.Sync(syncCategory, ddlRegion.SelectedValue); string msg = string.Empty; if (returnValue > 0) { msg = "操作成功"; } else { msg = "操作失败"; } ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "Add", "alert('" + msg + "');", true); } catch (Exception ex) { ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "Add", "alert('" + ex.Message + "');", true); } } protected void btnTest_Click(object sender, EventArgs e) { this.doTest(); } }
http://topic.csdn.net/u/20100106/14/8bff4bb6-549c-4e36-ade3-5dd0f7bd4549.html?74576jquery 进度条
我刚才看了,也试了,初步能达到效果,但是除了IE,其他浏览器访问不了,而且弹出框也不弹出了。
Network Error (tcp_error) A communication error occurred: "Operation timed out"
</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"));
}