In Web applications whenever a post back is done the entire page will be completely redrawn. The redrawing of the page will cause the screen to 'flicker' and the page will scroll to the top resulting in a poor user experience. ASP.NET has a cool feature called SmartNavigation, which solves these problems. SmartNavigation is a great feature which makes Web applications much more user friendly akin to the traditional windows application. The main advantages of using SmartNavigation are:
- No more screen flickering during a post back
- Scroll position of the page will be maintained after a post back
- Focus will be retained on the control which does the post back
All you have to do to make use of this features is set the SmartNavigation attribute of the Page to true.
<%@Page SmartNavigation=true%> |
Smart navigation can also be enabled for the entire application by setting the SmartNavigation attribute of pages to true in web.config file.
<configuration> <system.web> <pages smartNavigation="true"> </system.web> </configuration> |
What actually happens internally with SmartNavigation is that the page will be loaded within an IFRAME and only the parts of the page that have changed are rendered. On viewing the output source you will be able to see that a property called __smartNavEnabled has been added to the form and its value is set to true. SmartNavigation also uses a JavaScript file SmartNav.js internaly.
SmartNavigation is an Internet Explorer only feature and requires IE5 plus to work. But enabling SmartNavigation will not affect your application in any way even if your application targets multiple browsers because ASP.NET will automatically detect the browser and enable SmartNavigation only for supported browsers.

浙公网安备 33010602011771号