PDA

View Full Version : نمایش انتظار برای کاربر حین انجام کاری



iekrang
دوشنبه 18 اردیبهشت 1385, 05:02 صبح
سلام.
من چطور میتونم حین انجام کاری به کاربر این پیغام رو بدم که لطفاً منتظر باشید یا کرسر و تغییر بدم یا ...
فرضاً زمانی که داره عمل سرچ رو انجام میده؟
ممنون میشم اگر راهنماییم کنید.

manager
دوشنبه 18 اردیبهشت 1385, 19:46 عصر
می تونید عمل Response.Flush رو فراخوانی کنید و در این Stream یک کد Javascript بگذارید که مثلا کرسر را علامت ساعت شنی کند سپس هنگامی که عمل Search تمام شد و صفحه آماده نمایش شد (Response خودش اتوماتیک Flush شد) کد قبلی را Deactive کنید.

mamadgmail
دوشنبه 18 اردیبهشت 1385, 20:14 عصر
آقای manager می شه یک مثال برنید.الیته اگر ممکنه.ممنون

white fox
سه شنبه 19 اردیبهشت 1385, 00:18 صبح
در این مقاله شما با اصول این کار به طور کامل آشنا میشید.
http://www.informit.com/articles/article.asp?p=174363&rl=1

در این مقاله هم یک کامپوننت براتون گذاشته به همراه توضیح که کافیه در پروژتون از DLL اون استفاده کنید...احتیاج به هیچ چیزه دیگه ای هم نداره به راحتی قابل استفاده هست.

http://www.codeproject.com/aspnet/PleaseWaitButton.asp

مطمئنا این دومی کمک عالی هست برای شما...باز هم خواستید مثال های راحت تری دارم که با جاوا اسکریپت کار میکنه..

iekrang
سه شنبه 19 اردیبهشت 1385, 12:10 عصر
ممنون از توجهتون. :تشویق:

باز هم خواستید مثال های راحت تری دارم که با جاوا اسکریپت کار میکنه..
اگه لطف کنید ممنون میشم :چشمک:

white fox
سه شنبه 19 اردیبهشت 1385, 21:04 عصر
این هم یک مثال ساده که از جاوا اسکریپت استفاده کرده و از همون Response.Flush که آقای manager نام بردند هم استفاده کرده .توضیحات در خود کد داده شده است.



The Page_Load event of the webform should have the following code:

private void Page_Load(object sender, System.EventArgs e)
{
// Write div tag to the page that will contain the text for the progress bar.
Response.Write("<div id='mydiv' >");
Response.Write("_");
Response.Write("</div>");
Response.Write("<script>mydiv.innerText = '';</script>");

// Javascript to do the work of the progress bar.
// There are three functions.
// 1. ShowWait: Sets text of the div tag to "Loading" followed by 10 periods ".........."
// 2. StartShowWait: Calls the ShowWait function every second and make the div tag visible.
// 3. HideWait: Hides the div tag when the page is done loading. It is called from a script block
// that you need to add to the HTML page as the last element.
Response.Write("<script language=javascript>;");
Response.Write("var dots = 0;var dotmax = 10;function ShowWait()");
Response.Write("{var output; output = 'Loading';dots++;if(dots>=dotmax)dots=1;");
Response.Write("for(var x = 0;x < dots;x++){output += '.';}mydiv.innerText = output;}");
Response.Write("function StartShowWait(){mydiv.style.visibility = 'visible'; window.setInterval('ShowWait()',1000);}");
Response.Write("function HideWait(){mydiv.style.visibility = 'hidden';window.clearInterval();}");
Response.Write("StartShowWait();</script>");

Response.Flush();

// This really doesn't serve any purpose, other than to help with the sample code. After 10 seconds, the page will stop loading and the progress bar will disappear.
Thread.Sleep(10000);
}

One other thing you need to do is add a script block at the bottom of your HTML page as follows:

<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<!-- All you form data goes here -->
</form>
<!-- Add this script block as the last element in your document. It will hide the progress bar when the page loads -->
<script>
HideWait();
</script>
</body>


روش سخت تر هم بلدم که بگم ...loooooooooooooooooooool

PrinceDotNet
سه شنبه 19 اردیبهشت 1385, 21:35 عصر
ممنون میشیم

sajedi
چهارشنبه 20 اردیبهشت 1385, 18:34 عصر
jaleb bood