CodeSnip: Taming the Page Flash Beast in ASP.NET 2.0
 
Published: 18 Apr 2007
Abstract
Since SmartPageNavigation has gone to the wayside, there has been no real, non-AJAX way of eliminating the flash when a postback occurs. This code snippet will explain how to eliminate the page flash without using AJAX.
by Shaun Eutsey
Feedback
Average Rating: 
Views (Total / Last 10 Days): 24639/ 55

Introduction

Technology advancements are great.  They really are.  They create ways of doing things faster, better and with added stability.  However, every once in a while something gets left behind from an older technology, whether it was because it was not widely used or there were bugs in its implementation or there is a new feature that deprecates the old one.

Problem

To me, one of the features that I miss the most about ASP.NET 1.1 is the SmartNavigation.  Yes, it had some bugs, but the idea behind it was brilliant.  With one simple setting you could maintain the pages postback position and virtually eliminate the page flash. 

While there is a very real and valid alternative in .NET 2.0 for handling postback position, MaintainScrollPositionOnPostback, there is still the issue with page flashes.  I find pages flashing annoying and I have recently been on a quest to defeat this enemy. 

While searching high and low for a good, solid, solution to my dilemma, I remembered a meta-tag that I have not used in many years.  A meta-tag that would take care of all page flash problems, while letting MaintainScrollPositionOnPostback handle the scroll position.

Solution

“What is this amazing tag?” you say.  “How can I slay the page flashing beast?” you ask.  Just add the following meta-tag to the <head> of your page or in your master page.

Listing 1

<meta http-equiv="Page-Exit" Content="blendTrans(Duration=0.01)"/>

Most likely the reason that I forgot this tag is that it is usually used to create a highly painful user experience, by blending one page to the other.  However, when the duration is moved down to 0.01, like I have it here, the transition from postback to refresh is so fast that the human eye does not see it and all realization of a page flash is utterly removed.

Conclusion

I hope this helps any of you who have been beleaguered by page flashing in 2.0.  I know it has brought me a great amount of relief in trying to provide a consistent and solid experience for my users.



User Comments

Title: Still works!   
Name: Chuck
Date: 2010-10-11 10:33:55 AM
Comment:
I've been having headaches from a custom control that, even when in an update panel, caused the page to flash.

This solution seems to be working so far... Thanks a lot!
Title: Eliminate page flash   
Name: PeterM
Date: 2008-11-28 2:30:11 PM
Comment:
I can't tell you how many hours I've put in and different techniques I've tried to overcome this problem, and you've solved it in 10 seconds! Thanks very much!
Title: Works in ASP.Net 1.0!   
Name: MikeG3
Date: 2008-05-27 4:40:54 PM
Comment:
We're still on 1.0, but this trick works great! Thanks!
Title: Amazing use of Meta Tag   
Name: Mark
Date: 2008-05-03 12:52:03 PM
Comment:
This trick is Excellent! I wouldn't have thought of it in a million years. Very creative use of meta tags. The old meets the new!
Title: FLash And XML   
Name: Flash
Date: 2008-04-18 5:08:17 AM
Comment:
i want these, how to pass a xml textbox value to flash using actionscript.
Title: excellent trick   
Name: tana
Date: 2007-10-24 9:40:51 AM
Comment:
thank you very much
Title: Thank you   
Name: Byteknight
Date: 2007-10-05 8:17:25 AM
Comment:
Thanks a lot. It really works . Very helpful!

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-12-01 6:46:36 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search