The Artima Developer Community
Sponsored Link

.NET Buzz Forum
SmartNavigation has Internet Explorer displaying the wrong html source

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Peter van Ooijen

Posts: 284
Nickname: petergekko
Registered: Sep, 2003

Peter van Ooijen is a .NET devloper/architect for Gekko Software
SmartNavigation has Internet Explorer displaying the wrong html source Posted: Jan 11, 2006 6:19 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Peter van Ooijen.
Original Post: SmartNavigation has Internet Explorer displaying the wrong html source
Feed Title: Peter's Gekko
Feed URL: /error.htm?aspxerrorpath=/blogs/peter.van.ooijen/rss.aspx
Feed Description: My weblog cotains tips tricks and opinions on ASP.NET, tablet PC's and tech in general.
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Peter van Ooijen
Latest Posts From Peter's Gekko

Advertisement

SmartNavigation is a feature which can cause quite a lot of trouble. It is a property of an asp.net webpage intended to improve the "user experience" over postbacks by

  • Maintaining the scroll position in the browser
  • Maintaining the history over pages. Clicking back navigates to the previous page viewed instead of the previous roundtrip of the same page

The feature only works in Internet Explorer and has some bizarre side effects. Navigating to another page from code just does not work right. View source and Save As in IE are a complete WTF. I did write a small entry on that before, had forgotten about it until it hit me again last week.

Here's a web page to demonstrate the problem. It has two panels and a radiobuttonlist to pick which of them will be visible

protected void Page_Load(object sender, EventArgs e)
{
   Panel1.Visible = RadioButtonList1.SelectedIndex == 0;
   Panel2.Visible = RadioButtonList1.SelectedIndex == 1;
}

Panel1 contains a bulletlist, panel2 a calendar. It should be easy to see both in the browser and in the underlying HTML which panel is rendered. The result in IE :

When displaying the source IE will return the HTML of the first roundtrip. This is very clear for the panel; the browser displays panel TWO, the source displays the HTML of panel ONE. You can also spot the differences in the smaller details. The page has a label to display the roundtrip count. In the source the text of this label is always 1.

In VS 2005 the SmartNavigation property is considered obsolete. It still works and does display the same errant behavior. The Page.SetFocus method and Page.MaintainScrollPositionOnPostBack property are proposed as alternative. These do not maintain the history of pages visited. To get that fixed independent of SmartNavigation-settings and browser-brand you'll have to use a custom button. May I suggest this one ?

Read: SmartNavigation has Internet Explorer displaying the wrong html source

Topic: An Excellent Rationale for Ruby on Rails Previous Topic   Next Topic Topic: Windows More Secure?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use