Microsoft.SharePoint.WebCon ...


SPRememberScroll Class (Microsoft.SharePoint.WebControls)

Namespace: Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Syntax

Visual Basic (Declaration)
<ParseChildrenAttribute(ChildrenAsProperties:=False)> _
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class SPRememberScroll
    Inherits Panel
Visual Basic (Usage)
Dim instance As SPRememberScroll
C#
[ParseChildrenAttribute(ChildrenAsProperties=false)] 
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
public sealed class SPRememberScroll : Panel
Inheritance Hierarchy

System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
       System.Web.UI.WebControls.Panel
        Microsoft.SharePoint.WebControls.SPRememberScroll
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Tags :


Community Content

Adam Buenz - MVP
SPRememberScroll

Description

The Microsoft.SharePoint.WebControls.SPRememberScroll class inherits from the System.Web.UI.WebControls.Panel class since SPRememberScroll acts as a placeholder for childern controls. However, unlike a Panel control SPRememberScroll is commonly employed for one control rather than grouping related controls. To handle the scrolling position persistence for controls within SharePoint, it is possible to add them to the SPRememberScroll control collection for rendering.

The SPRememberScroll class functions by placing relevant display attributes, namely "ScrollTop" and "ScrollLeft" on the Page object. These can subsequently be called out and through the use of JavaScript functions, maintaining scrolling position when leveraging particular controls.

Usage Scenario

The ordinary usage for the SPRememberScroll control is with navigational elements since they contain user mutable elements, the most common in SharePoint development being the SPTreeView control.

Because of the inheritance of SPRememberScroll from Panel, it can be treated as an orthodox Panel control. When developing a composite control, a new SPRememberScroll object can be hydrated, a control added to the SPRememberScroll.Controls collection, and then added to the current instance control collection for rendering.

In the below, a new SPRememberScroll object is being created and its ID property being set. Following a new SPTreeView object is created, its ID and DataSourceID property set, which is added to the SPRememberScroll.Controls collection. Lastly, the SPRememberScroll object is added to the current instance control collection.

C# Code Example

protected override void CreateChildControls()
{
SPRememberScroll scroll = new SPRememberScroll();
scroll.ID = "Scroller";
SPTreeView view = new SPTreeView();
view.ID = "MyWebTreeView";
view.DataSourceID = "MyDataSourceId";
scroll.Controls.Add(view);
base.CreateChildControls();
}

VB.NET Code Example

Protected Overloads Overrides Sub CreateChildControls()
Dim scroll As New SPRememberScroll()
scroll.ID = "Scroller"
Dim view As New SPTreeView()
view.ID = "MyWebTreeView"
view.DataSourceID = "MyDataSourceId"
scroll.Controls.Add(view)
MyBase.CreateChildControls()
End Sub


Tags :

Page view tracker