影像显示 [英] Image Display
本文介绍了影像显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须显示动画图像,直到进行中.
说,
我正在从数据库中获取数据,这花费了太多时间,只是我想显示动画图像直到数据获取.
救救我...
感谢您的帮助.....
I have to display animated image till the work in progress.
say,
I am featching data from database it is taking too much time, just i want to display animated image till the data featch.
Help Me...
thanks in adv.....
推荐答案
使用 ^ ]控件.
如果您的页面是启用了Asp.net Ajax的页面(使用UpdatePanel
).但是,如果您不使用UpdatePanel
怎么办?
如何快速轻松地解决以下问题?
Using anUpdateProgress
control is the correct option if your page is an Asp.net Ajax enabled page (WithUpdatePanel
). But, what if you don''t useUpdatePanel
?
How about a quick easily solution as follows?
protected void Page_Load(object sender, EventArgs e)
{
Response.BufferOutput = false; //Do not buffer page output. Write response immediately to the browser
Response.Write(new string(' ', 256)); //Required for IE.
Response.Write("Processing...<br />"); //Show a fancy animation here, using an img html element or flash object
Response.Flush(); //Flush response immediately
Thread.Sleep(5000); //Mimics the expensive database operation for 5 seconds
Response.Write("<br />Done."); //Indicate operation is done.
Response.Flush();
}
当您在浏览器中点击页面时,将首先显示正在处理...",并在5秒钟后显示完成"消息,而不会刷新任何页面. 5秒的延迟是由于Thread.Sleep(5000)
引起的,您在此处调用数据库方法.
享受吧!
When you hit the page in the browser, the "Processing..." will be shown first and after 5 seconds the "Done" message will be shown without any page refresh. The 5 seconds delay is caused due to the Thread.Sleep(5000)
and you call your database method here.
Enjoy!
这篇关于影像显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文