This topic has not yet been rated - Rate this topic

MWSListViewSelector Class

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class MWSListViewSelector : ListViewSelector
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
MWSListViewSelector
Description

The Microsoft.SharePoint.WebControls.MWSListViewSelector class inherits from the Microsoft.SharePoint.WebControls.ListViewSelector class which sponsors the "Views" menu (List View Selector). Ultimately deriving from the TemplateBasedControl class, MWSListViewSelector is a component made into a coordinated template.

The MWSListViewSelector works by deriving from ListViewSelector class, which in turn inherits from TemplateBasedControl, and overriding the DefaultTemplateName property with its own string ID, "MWSViewSelector". The ID coordinates with the value of the ID attribute of a RenderingTemplate object in an ASCX file stored in the CONTROLTEMPLATES directory at the following location: 12\TEMPLATE\CONTROLTEMPLATES.

Usage Scenarios

The MWSListViewSelector generally is only used internally. However, within custom development the object may find use in combination with the ListFormWebPart class because of architectural dependence.

The below shows casting the current instance of a class to a ListFormWebPart then retrieving the ListFormWebPart.ToolBar property to hydrate a ToolBar object. Following, we are testing the context SPControlMode to make certain we are in display mode, then adding a new MWSListViewSelector to the RightButtons (RepeatedControls) of the ToolBar object.

C# Code Sample 

ToolBar toolbar = ((ListFormWebPart)this).Toolbar;
if (Equals(SPContext.Current.FormContext.FormMode, SPControlMode.Display))
{
MWSListViewSelector lvs = new MWSListViewSelector();
toolbar.RightButtons.Controls.Add(lvs);


Visual Basic .NET Code Sample

Dim toolbar As ToolBar = DirectCast(Me, ListFormWebPart).Toolbar
If Equals(SPContext.Current.FormContext.FormMode, SPControlMode.Display) Then
Dim lvs As New MWSListViewSelector()
toolbar.RightButtons.Controls.Add(lvs)
End If

Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com