C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




SmartNavigation to maintain scroll position across postbacks


Posted Date: 13 Sep 2006    Resource Type: Articles    Category: Web Applications
Author: Harish RanganathanMember Level: Gold    
Rating: Points: 10



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.







Responses

Author: Hiren Patel    13 Sep 2006Member 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


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Error: "Server Error in Application" while browsing an asp.net application
Previous Resource: Output Caching based on File Dependency
Return to Discussion Resource Index
Post New Resource
Category: Web Applications


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use