asp.net 页面导入时的等待效果,求助!!大侠帮忙啊!!!

SKY徐 2009-09-08 03:40:53

祈求帮助呀。。。大侠帮忙啊!!!

我在网上找了很多方法和代码,为什么没有一个可用的。都不能理想。

我要的效果就是:asp.net里面有大量的数据,再空白页面的时候显示“数据导入中”或“请等待”,最好是等待图片,当页面导入完成,等待标志消失。相信大家都见过。

希望大家帮忙,给一个页面改动小的方法,因为网站已经成形。最好是js的,如果ajax的修改不大的也行。

希望大侠给一个可行的例子。最好您测试通过的,因为我找个很久,没有找到能用(可能是我不会用,嘿嘿)!



谢谢,谢谢!!!
...全文
620 29 打赏 收藏 转发到动态 举报
写回复
用AI写文章
29 条回复
切换为时间正序
请发表友善的回复…
发表回复
haa17 2011-04-29
  • 打赏
  • 举报
回复
记录 记录
hl362496158 2011-03-22
  • 打赏
  • 举报
回复
[Quote=引用 10 楼 xuzhongxuan 的回复:]
wxd_860825,你好。 您的方法我试过了,设置一个固定的时间控制DIV的消失,这样好像不太合适,不管页面的数导入据快慢div都显示一样的时间。觉得不太理想。
[/Quote]

怎么可以设置时间列。
在ajax 的 beforeSend中写个div就可以了
type: "POST",
url: "DefectDisposition.axd",
data: "flag=GetDefectDistributeByPhase&version=" + Config.RdmVersion + "&domain=" + escape('软件') + "&serial=" + new Date().getTime(),
dataType: "json",
async: false,
beforeSend: function() {//发送消息前
QualityPublicMethod.Clear();
},
error: function(txt) {
Config.IsQualityNeedRequestDataIng = false;
},
success: function(txt) {
king_jiong 2010-02-24
  • 打赏
  • 举报
回复
good good ~~~
mhm891201 2010-01-13
  • 打赏
  • 举报
回复
用层+javascript是很正确的
jeanso 2009-09-09
  • 打赏
  • 举报
回复
iframe 框架页面里好实现
乐于编程 2009-09-09
  • 打赏
  • 举报
回复
好问题,希望有一天我也能做出这样的效果。
sniperhe 2009-09-09
  • 打赏
  • 举报
回复
jquery的ajax中有个方法的
$.ajax({
url:
onsuccess:function(data){ $("#divxxxx").html(data);}
})
差不多是这样的一个方法
导入的时候div或什么标签的先显示loading
完成的时候就会实现innerhtml的效果
wxd_860825 2009-09-09
  • 打赏
  • 举报
回复
你再仔细看看,我那个时间是打开网页时,如果执行速度小于3秒就直接进了,如果大于3秒,就执行遮罩层
wxd_860825 2009-09-09
  • 打赏
  • 举报
回复
我那没有设置固定的时间,我那是数据加载完毕后,div才消失呢
SKY徐 2009-09-09
  • 打赏
  • 举报
回复
wxd_860825,你好。 您的方法我试过了,设置一个固定的时间控制DIV的消失,这样好像不太合适,不管页面的数导入据快慢div都显示一样的时间。觉得不太理想。
xml120 2009-09-09
  • 打赏
  • 举报
回复
顶哦。我也想学习那样的效果。

嘿~
chenyunkun2008 2009-09-09
  • 打赏
  • 举报
回复
myhid 2009-09-09
  • 打赏
  • 举报
回复
<body onload="隐藏等待层">
erytbc 2009-09-09
  • 打赏
  • 举报
回复
page_load中写init();

/// <summary>页面加载中效果</summary>
/// <returns></returns>
public static void init()
{
HttpContext.Current.Response.Write(" <script language=JavaScript type=text/javascript>");
HttpContext.Current.Response.Write("var t_id = setInterval(animate,20);");
HttpContext.Current.Response.Write("var pos=0;var dir=2;var len=0;");
HttpContext.Current.Response.Write("function animate(){");
HttpContext.Current.Response.Write("var elem = document.getElementById('progress');");
HttpContext.Current.Response.Write("if(elem != null) {");
HttpContext.Current.Response.Write("if (pos==0) len += dir;");
HttpContext.Current.Response.Write("if (len>32 || pos>79) pos += dir;");
HttpContext.Current.Response.Write("if (pos>79) len -= dir;");
HttpContext.Current.Response.Write(" if (pos>79 && len==0) pos=0;");
HttpContext.Current.Response.Write("elem.style.left = pos;");
HttpContext.Current.Response.Write("elem.style.width = len;");
HttpContext.Current.Response.Write("}}");
HttpContext.Current.Response.Write("function remove_loading() {");
HttpContext.Current.Response.Write(" this.clearInterval(t_id);");
HttpContext.Current.Response.Write("var targelem = document.getElementById('loader_container');");
HttpContext.Current.Response.Write("targelem.style.display='none';");
HttpContext.Current.Response.Write("targelem.style.visibility='hidden';");
HttpContext.Current.Response.Write("}");
HttpContext.Current.Response.Write("</script>");
HttpContext.Current.Response.Write("<style>");
HttpContext.Current.Response.Write("#loader_container {text-align:center; position:absolute; top:1%; width:100%; left: 0;}");
HttpContext.Current.Response.Write("#loader {font-family:Tahoma, Helvetica, sans; font-size:11.5px; color:#000000; background-color:#FFFFFF; padding:10px 0 16px 0; margin:0 auto; display:block; width:130px; border:1px solid #5a667b; text-align:left; z-index:2;}");
HttpContext.Current.Response.Write("#progress {height:5px; font-size:1px; width:1px; position:relative; top:1px; left:0px; background-color:#8894a8;}");
HttpContext.Current.Response.Write("#loader_bg {background-color:#e4e7eb; position:relative; top:8px; left:8px; height:7px; width:113px; font-size:1px;}");
HttpContext.Current.Response.Write("</style>");
HttpContext.Current.Response.Write("<div id=loader_container>");
HttpContext.Current.Response.Write("<div id=loader>");
HttpContext.Current.Response.Write("<div align=center>页面正在加载中 ...</div>");
HttpContext.Current.Response.Write("<div id=loader_bg><div id=progress> </div></div>");
HttpContext.Current.Response.Write("</div></div>");
HttpContext.Current.Response.Flush();
}


html里写:window.onload = remove_loading();
杰子 2009-09-09
  • 打赏
  • 举报
回复
我可以给你一个提交按钮编程等待的例子。就想csdn留言是的【提交回复】效果一样,你看看有用不
public void page_load(Object obj, EventArgs e)
{
btn.Attributes.Add("onclick","state=true;");
StringBuilder sb=new StringBuilder();
sb.Append("if (!state) return;");
sb.Append("var button=document.getElementById('btn');");
sb.Append("button.value=' Please Wait... ';");
sb.Append("document.body.style.cursor='wait';");
sb.Append("button.disabled=true;");

string strScript="<script>";
strScript=strScript +"var state=false;";

//将函数绑定到页面的onbeforeunload事件:
strScript=strScript +"window.attachEvent('onbeforeunload',function(){" +sb.ToString()+ "});";
strScript=strScript +"</"+"script>";
Page.RegisterStartupScript("onbeforeunload",strScript);
}

protected void Submit_Click(object sender, EventArgs e)
{
//模拟长时间的按钮处理
System.Threading.Thread.Sleep(2000);
Response.Write("<script>alert('保存成功!');" + "</" + "script>");
}
Ricercar 2009-09-09
  • 打赏
  • 举报
回复
如果你用postback的话,没办法做,用ajax实现很简单
琥珀明月 2009-09-09
  • 打赏
  • 举报
回复
div遮罩,学习~
Aderlee 2009-09-08
  • 打赏
  • 举报
回复
就一个简单的div显示和隐藏而已,不过div要绝对定位。
alan0128 2009-09-08
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 chen_ya_ping 的回复:]
要不这样楼主,你先加载一部分数据到页面,然后其他没有加载的地方放置了一句话 “正在加载,请稍后...”

比如有个div,这个div中的数据时用AJAX方式来加载数据的(页面加载完成),那么先让这个div现实那就话,等有数据的时候就显示数据。
[/Quote]
一般就是这样做的
wzxiaozhuang 2009-09-08
  • 打赏
  • 举报
回复
学习下
加载更多回复(6)

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧