ASP.NET GIF进度条的显示
上传文件时间比较长,期间想显示一个GIF进度条图片,求详细的解决办法。AJAX和JS都试过了,由于没找到详细的办法,都没成功,请把代码贴全一点谢谢。 --------------------编程问答-------------------- 我也在找这个,帮顶下,顺便等高手, --------------------编程问答-------------------- 文件上传带进度条的风格
jQuery progressBar 做文件上传的进度条 --------------------编程问答-------------------- 有时我们需要在Asp.NET Web应用程序中显示 进度条。你可以添加像Please Wait!!!的文本。使用动态gif图像给用户一个等到信息直到任务结束。下面是解决这个问题。
在客户端添加下面的代码 行:
<script language="javascript">
HideDiv('splashScreen');
function HideDiv(objDiv)
if(document.getElementById(objDiv) != null)
"hidden";
</script>
在page_load事件中添加下列代码 行:
Response.Buffer = true;
Response.Write("<div ID='splashScreen' STYLE='position:absolute;z-index:5000;top:0;left:0;width:100%;height:100%;'><table cellspacing='0' cellpadding='0' border='0' align='center'><tr><td class='copy' align='right' height='260'><img src='http://huijianight.blog.163.com/blog/images/spacer.gif' width='0' align='absmiddle'></td></tr><tr><td class='copyblack' style='font-family:tahoma;font-size:11px' align='center'><img src='http://huijianight.blog.163.com/blog/images/hourglass.gif' border='0' align='absmiddle'><br><br> File has been uploaded .Data from the File is being stored in to the database ...!<br>Please Wait</td></tr></table></div>");
Response.Flush();
需要一张gif/jpg图片用于显示时钟或其他 的图像。
--------------------编程问答-------------------- http://www.cnblogs.com/homer/archive/2008/05/21/1204060.html
--------------------编程问答-------------------- 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(); } }
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(); } }
--------------------编程问答-------------------- 进度条。。。
ajax操作
http://topic.csdn.net/u/20100106/14/8bff4bb6-549c-4e36-ade3-5dd0f7bd4549.html?74576
jquery 进度条
--------------------编程问答-------------------- ajaxcontroltoolkit中的进度条就可以的 --------------------编程问答-------------------- http://www.51aspx.com/CV/Progressbar/ --------------------编程问答-------------------- 看看这个 --------------------编程问答-------------------- 很不错。http://www.open-open.com/ajax/Upload.htm --------------------编程问答--------------------
我刚才看了,也试了,初步能达到效果,但是除了IE,其他浏览器访问不了,而且弹出框也不弹出了。
Network Error (tcp_error)
A communication error occurred: "Operation timed out"
--------------------编程问答-------------------- 那你就弹出一个层 里面放朵菊花在那转吧 --------------------编程问答--------------------
请给出完整,详细的代码 --------------------编程问答--------------------
放个层 放个gif图片 --------------------编程问答-------------------- <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"));
} --------------------编程问答-------------------- http://nongfuit.com/article_show/8383.aspx
补充:.NET技术 , ASP.NET