UserInfoListFormToolBar Class
System.Object
System.Web.UI.Control
Microsoft.SharePoint.WebControls.SPControl
Microsoft.SharePoint.WebControls.TemplateBasedControl
Microsoft.SharePoint.WebControls.FormComponent
Microsoft.SharePoint.WebControls.UserInfoListFormToolBar
System.Web.UI.Control
Microsoft.SharePoint.WebControls.SPControl
Microsoft.SharePoint.WebControls.TemplateBasedControl
Microsoft.SharePoint.WebControls.FormComponent
Microsoft.SharePoint.WebControls.UserInfoListFormToolBar
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
UserInfoListFormToolBar
Description
The Microsoft.SharePoint.WebControls.UserInfoListFormToolBar class inherits from the Microsoft.SharePoint.WebControls.FormComponent class which is the base class for form-rendering and field-rendering controls. UserInfoListFormToolBar contains direction to other templates depending on what SPControlMode the current context is, either Display or Edit. Since for user management the SharePoint list interface is used, UserInfoListFormToolbar fills the gaps of user specific functionality.
UserInfoListFormToolBar works by overriding the TemplateBasedControl.ControlTemplate property whose assignment specifies the template that renders the control in the current context. This is accomplished by the use of the SPControlTemplateManager.GetTemplateByName method in order to pass in the appropriate template ID and in order to return a ITemplate container. The templates called can be found by specifying the RenderingTemplate with the ID of "UserInfoListDisplayFormToolBar" (for SPControlMode.Display)or “UserInfoListEditFormToolBar” (for SPControlMode.Edit) from DefaultTemplates.ascx. Both templates use a Toolbar object and its associated ToolBar.Template_Buttons property in order to specify the specific buttons for each context.
Usage Scenario
The primary usage of UserInfoListFormToolBar is internal since it has heavy representation on several of the shipped SharePoint WebForms, the most evident on the SharePoint User Profile Page (userdisp.aspx). However, it is possible to extend the control by directly editing the RenderingTemplate contents, removing it completely and specify a custom FormComponent in its place, or since it is a orthodox control adding it to a control collection for rendering. In the below I am demonstrating adding another control to the Template_Buttons in the DefaultTemplates.ascx for UserInfoListEditFormToolBar, in this case the control is the CreateModifiedInfo. As well, an example is providing of creating a new UserInfoListFormToolBar object and adding the object to the current control collection.
ASP.NET Code Example
<Template_Buttons>
<SharePoint:AttachmentButton runat="server"/>
<SharePoint:UserInfoListDeleteItemButton runat="server"/>
<SharePoint:ChangePasswordButton runat="server"/>
</Template_Buttons>
<Template_Buttons>
<SharePoint:AttachmentButton runat="server"/>
<SharePoint:UserInfoListDeleteItemButton runat="server"/>
<SharePoint:ChangePasswordButton runat="server"/>
<SharePoint:CreatedModifiedInfo runat="server"/>
</Template_Buttons>
C# Code Example
protected override void CreateChildControls()
{
UserInfoListFormToolBar toolBar = new UserInfoListFormToolBar();
toolBar.ID = "Toolbar";
Controls.Add(toolBar);
base.CreateChildControls();
}
Visual Basic .NET Code Example
Protected Overloads Overrides Sub CreateChildControls()
Dim toolBar As New UserInfoListFormToolBar()
toolBar.ID = "Toolbar"
Controls.Add(toolBar)
MyBase.CreateChildControls()
End Sub
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
The Microsoft.SharePoint.WebControls.UserInfoListFormToolBar class inherits from the Microsoft.SharePoint.WebControls.FormComponent class which is the base class for form-rendering and field-rendering controls. UserInfoListFormToolBar contains direction to other templates depending on what SPControlMode the current context is, either Display or Edit. Since for user management the SharePoint list interface is used, UserInfoListFormToolbar fills the gaps of user specific functionality.
UserInfoListFormToolBar works by overriding the TemplateBasedControl.ControlTemplate property whose assignment specifies the template that renders the control in the current context. This is accomplished by the use of the SPControlTemplateManager.GetTemplateByName method in order to pass in the appropriate template ID and in order to return a ITemplate container. The templates called can be found by specifying the RenderingTemplate with the ID of "UserInfoListDisplayFormToolBar" (for SPControlMode.Display)or “UserInfoListEditFormToolBar” (for SPControlMode.Edit) from DefaultTemplates.ascx. Both templates use a Toolbar object and its associated ToolBar.Template_Buttons property in order to specify the specific buttons for each context.
Usage Scenario
The primary usage of UserInfoListFormToolBar is internal since it has heavy representation on several of the shipped SharePoint WebForms, the most evident on the SharePoint User Profile Page (userdisp.aspx). However, it is possible to extend the control by directly editing the RenderingTemplate contents, removing it completely and specify a custom FormComponent in its place, or since it is a orthodox control adding it to a control collection for rendering. In the below I am demonstrating adding another control to the Template_Buttons in the DefaultTemplates.ascx for UserInfoListEditFormToolBar, in this case the control is the CreateModifiedInfo. As well, an example is providing of creating a new UserInfoListFormToolBar object and adding the object to the current control collection.
ASP.NET Code Example
<Template_Buttons>
<SharePoint:AttachmentButton runat="server"/>
<SharePoint:UserInfoListDeleteItemButton runat="server"/>
<SharePoint:ChangePasswordButton runat="server"/>
</Template_Buttons>
<Template_Buttons>
<SharePoint:AttachmentButton runat="server"/>
<SharePoint:UserInfoListDeleteItemButton runat="server"/>
<SharePoint:ChangePasswordButton runat="server"/>
<SharePoint:CreatedModifiedInfo runat="server"/>
</Template_Buttons>
C# Code Example
protected override void CreateChildControls()
{
UserInfoListFormToolBar toolBar = new UserInfoListFormToolBar();
toolBar.ID = "Toolbar";
Controls.Add(toolBar);
base.CreateChildControls();
}
Visual Basic .NET Code Example
Protected Overloads Overrides Sub CreateChildControls()
Dim toolBar As New UserInfoListFormToolBar()
toolBar.ID = "Toolbar"
Controls.Add(toolBar)
MyBase.CreateChildControls()
End Sub
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
- 6/3/2010
- Adam Buenz - MVP