How to show in aspx page (WebForms) the wait proce

2019-07-05 06:02发布

问题:

How can I show some type of message in my ASPX web page ( I'm using WebForms, not MVC ), which represents as a "wait process" while some method of my project is executing.

I'm not asking about how to make some HTML/CSS/DOM stuff, I'm asking more about asynchronous check.

For e.g.: some data from web could be delivered to client not quickly and when it does occur - it looks very ugly for the user. It's just idling and looks like a page with bug, where there is no well highlighted status ( many users don't watch in browsers the page loading states, they want to look it in web applications exactly, like in desktop applications ).

I want to show a message like "waiting for the operation end" and I don't know how to make an asynchronous check in my ASPX page for getting the current state when some methods execute ( are they finished or not etc... ).

What I really want looks like in pseudo-code:

while (methodExecuting) show(waitMessage);

How could it be done in WebForms of ASP.NET project?

回答1:

I suggest you use a "progressBar" indicating your condition periodically. Here is a good link explaining step by step how to use it.

Asynchronous processing in ASP.Net with Ajax progress bar

You can download this solution at the following: http://weblogs.asp.net/blogs/seanmcalinden/Solutions/AjaxProgressBarExample.zip



回答2:

I would have done it with JQuery UI Progress Bar.

Change your C# function to webmethod and then call it with jquery. here is the tutorial for you. Call the webmethod and enable the progress bar, when it is completed disable the progress bar.

hope it helps.