Home > .NET > Smart Navigation

Smart Navigation

Before going deeper in smart navigation, please not that it is no longer supported in asp.net versions after 2.0 and The SetFocus and MaintainScrollPositionOnPostBack are used instead.

Smart Navigation basically enhances a web page performance by doing the following:

  •  It eliminates the flash caused during navigation
  • It persists element focus during postbacks
  • It persists scroll position during postbacks between pages
  • It retains the lasts page information in the history of the browser

SmartNavigation is a feature provided by asp.net. When enabled this makes sure your pages are shown smoothly and last position of cursor location, scroll etc are restored effortlessly

It allows Internet Explorer to handle PostBacks in a very clever way. You don’t have to worry about having a long site – it will return to the point where you have been before. Or if you define some events – SmartNavigation will enable you to invoke the handlers without posting the page back to the server.

But: If you are going to program a serious website for users of different browsers (Netscape, Opera, Konqueror or Safari) you need to turn SmartNavigation off, because it simply doesn’t work with this kind of browsers.

  •    How to use:
  1. Add the yellow highlighted line in your application web.config file(be sure you don’t have this attribute before).
    <pages smartNavigation=”true”/> 
  2. Or on a specific page where we can add this property in the page directive like this:
    <%@ Page Language=”VB” SmartNavigation=”true” %>
  • Why To Use:
  1. Saves the position of your scroll state after redirecting the page, for example if you have a page that has a scroll and at the end of the page there is a delete button which will also shows a message like “are you sure you want to delete this item?”.this message will appear at the bottom of the page also after redirecting the page will goes to top and the user will not know what happened unless he scrolls down again and reads the message, using Smart Navigation will allow you to keep that scroll.

  2. Keeps focus on server controls (textboxes and buttons…) after redirecting also.
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: