MWSListViewSelector Class
System.Object
System.Web.UI.Control
Microsoft.SharePoint.WebControls.SPControl
Microsoft.SharePoint.WebControls.TemplateBasedControl
Microsoft.SharePoint.WebControls.ListViewSelector
Microsoft.SharePoint.WebControls.MWSListViewSelector
System.Web.UI.Control
Microsoft.SharePoint.WebControls.SPControl
Microsoft.SharePoint.WebControls.TemplateBasedControl
Microsoft.SharePoint.WebControls.ListViewSelector
Microsoft.SharePoint.WebControls.MWSListViewSelector
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
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
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
- 6/3/2010
- Adam Buenz - MVP