Introduction All of us know that asp.net controls postback to the server and hence the page is reloaded everytime an event is triggered.
ASP.NET Controls Postback All of us know that asp.net controls postback to the server and hence the page is reloaded everytime an event is triggered.
Supposing we have a very long page with lots of controls. A user is in the middle of the page and triggers an event (say click event), which causes the page to postback. Then the page will be reloaded and the position would go to the top.
This could be particularly annoying if the user has to scroll down long and repetitively.
How to avoid this? To avoid this, ASP.NET provides the SmartNavigation property for the page which takes care of the scroll position.
SmartNavigation also avoids the flickering of the page when the page is reloaded.
It can be enabled by simply setting its value to true in the page directive, as follows:-
<%Page smartNavigation="True" %>
Alternatively, it can be specified as a global setting in the web.config as follows:-
<configuration> <system.web> <pages smartNavigation="true"/> </system.web> </configuration>
This would apply for all the pages that fall under the web.config's settings.
This is a wonderful mechanism particularly if you have lengthy pages and repetitive server side interactions.
Applies to This works only for Internet Explorer browsers and for Netscape, it is simply turned off automatically.
Caveats Another issue that may arise is when using javascript and dhtml scripts as they will not be rendered again while using smartnavigation.
Summary This article discussed on SmartNavigation a mechanism to retain scroll position across postbacks.
|
| Author: Hiren Patel 13 Sep 2006 | Member Level: Gold Points : 0 |
Hi All,
This article about smart navigation is good but there is one bug when we are going to use this functionality in our page that having Javscript or some kind of javascript menu
At that time javascript is not working due to smartNavigation
If you are using asp.net 2.0 than its ok and if you are using asp.net 1.1 than problem exist.
Regards, Hiren http://hidigs.uni.cc
|