Click Here to Install Silverlight*
IndiaChange|All Microsoft Sites
MSDN
|Developer Centers|Library|Downloads|How To Buy|Subscribers|My MSDN
 
Maintain Scroll Position Control in ASP.NET
By Saravana
 
Tool Posted: November 04, 2003
 

Download

(After downloading, please change the extension of the file to ".zip")

Introduction
 
This tool consists of control which is used to maintain scroll position across postbacks. In ASP.NET to maintain scroll position across postbacks, We can use Smart Navigation property. Since it might create problems in some cases, we can use javascript to maintain scroll position across postbacks. This control will take care of injecting client side scripts for maintaining scroll position. You only need to set few properties for this control.
 
 
 
MaintainScrollPosition
 
This control is used to maintain scroll position acorss postbacks. This control has following two properties:
BodyTagID This property is used to link body tag of your aspx page with this control. In this property you need to give the id to the body tag
Enabled This property is used for enabling or disabling this control depending upon the requirement.
 
Note: To get the body tag id, do the following steps:
1. In your aspx page, give id for your body tag and set runat attribute for your body tag.
2. In code behind file, declare your body tag element as htmlgenericontrol. For example:
 
Protected WithEvents bodytag1 As
System.Web.UI.HtmlControls.HtmlGenericControl
 
 
Installation Procedure
 
Extract the Zip file attached with this article to your local folder. Then include this control in VS.NET ToolBox. In the Designer, right-click on the Toolbox and choose Add/Remove Items . Again, select the MaintainScrollPosition.dll file. This will one new item to the Toolbox as show in the above figure. You can then drag and drop the control from the Toolbox onto the Designer. After drag and drop, you can use property window to set the properties for this control.
 

Download

(After downloading, please change the extension of the file to ".zip")

Saravana
Microsoft Community Star
www.extremeexperts.com
 

©2009 Microsoft Corporation. All rights reserved. Contact Us |Terms of Use |Trademarks |Privacy Statement
Microsoft