CreatedModifiedInfo Class
Represents the “create by” and “modified by” information blocks that are rendered at the bottom of display and edit forms.
System.Object
System.Web.UI.Control
Microsoft.SharePoint.WebControls.SPControl
Microsoft.SharePoint.WebControls.TemplateBasedControl
Microsoft.SharePoint.WebControls.FormComponent
Microsoft.SharePoint.WebControls.CreatedModifiedInfo
System.Web.UI.Control
Microsoft.SharePoint.WebControls.SPControl
Microsoft.SharePoint.WebControls.TemplateBasedControl
Microsoft.SharePoint.WebControls.FormComponent
Microsoft.SharePoint.WebControls.CreatedModifiedInfo
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
CreatedModifiedInfo
Description
The Microsoft.SharePoint.WebControls.CreatedModifiedInfo class inherits from the Microsoft.SharePoint.WebControls.FormComponent class which is the foundational control for form and field rendering controls. The CreatedModifiedInfo class is responsible for displaying the customary author and page creation information.
The CreatedModifiedInfo control works by the use of the SPControlTemplateManager.GetTemplateByName method which will take a string in order to retrieve the corresponding RenderingTemplate. There are three values that are possible for use with the CreatedModifiedInfo control:
"CreatedModifiedInfo" produces:
Created at <Time> by <User>
Last modified at <Time> by <User>
"CreatedModifiedVersionInfo" produces:
Version: 3.0
Created at <Time> by <User>
Last modified at <Time> by <User>
"CreatedVersionInfo" produces :
Version: 3.0
Created at <Time> by <User>
By default, "CreatedModifiedVersionInfo" will be used if the SPList.EnableVersioning property is set to true. If not, then the "CreatedModifiedInfo" template is used.
The Usage Scenario
The primary use of CreatedModifiedInfo is when it is desired to have the customary author and page creation information displayed on a page. This is common when extending the default SharePoint list pages with detailed, custom interfaces.
In the below, I am demonstrating the instantiating three CreatedModifiedInfo objects. However, each of the created objects haave different TemplateBasedControl.TemplateName properties that reference the various templates that can be used. After creating the objects, the controls are add to the current instance control collection.
C# Code Example
protected override void CreateChildControls()
{
CreatedModifiedInfo info1 = new CreatedModifiedInfo();
info1.ID = "CreatedModifiedInfo";
info1.TemplateName = "CreatedModifiedInfo";
CreatedModifiedInfo info2 = new CreatedModifiedInfo();
info2.ID = "CreatedModifiedVersionInfo";
info2.TemplateName = "CreatedModifiedVersionInfo";
CreatedModifiedInfo info3 = new CreatedModifiedInfo();
info3.ID = "CreatedVersionInfo";
info3.TemplateName = "CreatedVersionInfo";
Controls.Add(info1);
Controls.Add(info2);
Controls.Add(info3);
}
Visual Basic .NET Code Example
Protected Overloads Overrides Sub CreateChildControls()
Dim info1 As New CreatedModifiedInfo()
info1.ID = "CreatedModifiedInfo"
info1.TemplateName = "CreatedModifiedInfo"
Dim info2 As New CreatedModifiedInfo()
info2.ID = "CreatedModifiedVersionInfo"
info2.TemplateName = "CreatedModifiedVersionInfo"
Dim info3 As New CreatedModifiedInfo()
info3.ID = "CreatedVersionInfo"
info3.TemplateName = "CreatedVersionInfo"
Controls.Add(info1)
Controls.Add(info2)
Controls.Add(info3)
End Sub
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
The Microsoft.SharePoint.WebControls.CreatedModifiedInfo class inherits from the Microsoft.SharePoint.WebControls.FormComponent class which is the foundational control for form and field rendering controls. The CreatedModifiedInfo class is responsible for displaying the customary author and page creation information.
The CreatedModifiedInfo control works by the use of the SPControlTemplateManager.GetTemplateByName method which will take a string in order to retrieve the corresponding RenderingTemplate. There are three values that are possible for use with the CreatedModifiedInfo control:
"CreatedModifiedInfo" produces:
Created at <Time> by <User>
Last modified at <Time> by <User>
"CreatedModifiedVersionInfo" produces:
Version: 3.0
Created at <Time> by <User>
Last modified at <Time> by <User>
"CreatedVersionInfo" produces :
Version: 3.0
Created at <Time> by <User>
By default, "CreatedModifiedVersionInfo" will be used if the SPList.EnableVersioning property is set to true. If not, then the "CreatedModifiedInfo" template is used.
The Usage Scenario
The primary use of CreatedModifiedInfo is when it is desired to have the customary author and page creation information displayed on a page. This is common when extending the default SharePoint list pages with detailed, custom interfaces.
In the below, I am demonstrating the instantiating three CreatedModifiedInfo objects. However, each of the created objects haave different TemplateBasedControl.TemplateName properties that reference the various templates that can be used. After creating the objects, the controls are add to the current instance control collection.
C# Code Example
protected override void CreateChildControls()
{
CreatedModifiedInfo info1 = new CreatedModifiedInfo();
info1.ID = "CreatedModifiedInfo";
info1.TemplateName = "CreatedModifiedInfo";
CreatedModifiedInfo info2 = new CreatedModifiedInfo();
info2.ID = "CreatedModifiedVersionInfo";
info2.TemplateName = "CreatedModifiedVersionInfo";
CreatedModifiedInfo info3 = new CreatedModifiedInfo();
info3.ID = "CreatedVersionInfo";
info3.TemplateName = "CreatedVersionInfo";
Controls.Add(info1);
Controls.Add(info2);
Controls.Add(info3);
}
Visual Basic .NET Code Example
Protected Overloads Overrides Sub CreateChildControls()
Dim info1 As New CreatedModifiedInfo()
info1.ID = "CreatedModifiedInfo"
info1.TemplateName = "CreatedModifiedInfo"
Dim info2 As New CreatedModifiedInfo()
info2.ID = "CreatedModifiedVersionInfo"
info2.TemplateName = "CreatedModifiedVersionInfo"
Dim info3 As New CreatedModifiedInfo()
info3.ID = "CreatedVersionInfo"
info3.TemplateName = "CreatedVersionInfo"
Controls.Add(info1)
Controls.Add(info2)
Controls.Add(info3)
End Sub
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
- 6/3/2010
- Adam Buenz - MVP