开发者

JQuery - ASP.NET postback "loading" gif - is it possible?

just wondering, is it possible to have a "loading" gif while the page is posting back?

Chee开发者_如何学编程rs


You can start a "loading" animation in javascript (by binding to the form submit event).

However, some browsers will stop javascript processing as soon as the new request starts or as soon as a response starts.

In other words, since this is a full postback, no not possible.

Investigate using AJAX for partial page updates.


I literally just blogged about how to do this, I have been working out a solution for the last few hours, you will have to use a loading.aspx page: http://alanfeekery.com/post/8510926813/how-to-maintain-a-gif-animation-after-a-page-postback

If you want to stay on the same page though (presuming your using webforms), the built in Ajax controls are the way to go. You can use an UpdatePanel to wrap content that will be changed and an associated UpdateProgress panel to bring up loading informtion and in your case your gif animation.


I have found this post which exactly solves your (and mine for that matter) problem. I've only tested this in Internet Explorer though, so don't shoot me if it's not cross browser compatible.

(if indeed some other browsers completely stop javascript from executing this will be of no help I would think)

'+ it seems to be super-hacky to me :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜