RenderingTemplateContainer Class
System.Object
System.Web.UI.Control
Microsoft.SharePoint.WebControls.RenderingTemplateContainer
Microsoft.SharePoint.WebControls.SPCalendarContainer
Microsoft.SharePoint.WebControls.SPCalendarItemContainer
Microsoft.SharePoint.WebControls.SPCalendarTabContainer
System.Web.UI.Control
Microsoft.SharePoint.WebControls.RenderingTemplateContainer
Microsoft.SharePoint.WebControls.SPCalendarContainer
Microsoft.SharePoint.WebControls.SPCalendarItemContainer
Microsoft.SharePoint.WebControls.SPCalendarTabContainer
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)] [AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] public class RenderingTemplateContainer : Control, IDataItemContainer, INamingContainer
RenderingTemplateContainer
Description
The Microsoft.SharePoint.WebControls.RenderingTemplateContainer class inherits from the System.Web.UI.IDataItemContainer interface for data item object identification as well as the System.Web.UI.Control class in order to define an ASP.NET server control. The RenderingTemplateContainer represents an individual container data item within a RenderingTemplate.
RenderingTemplateContainer works through the use of three properties.
RenderingTemplateContainer.DataItem – Represents an individual data item bound with the RenderingTemplate
RenderingTemplateContainer.DataItemIndex – Represents the index of the data item
RenderingTemplateContainer. DisplayIndex – Represents the position of the item as displayed with the RenderingTemplate
The Usage Scenario
The primary use of RenderingTemplateContainer is internal, having representation in SPCalendar* classes. However, it is possible to use RenderingTemplateContainer as a base class within custom development.
In the below, the MyContainer class is inheriting from the RenderingTemplateContainer class. I am declaring a global object type variable which represents the data item.
C# Code Example
public class MyContainer : RenderingTemplateContainer
{
private readonly object obj;
public MyContainer(object obj)
{
this.obj = obj;
}
public object DataItem
{
get
{
return obj;
}
}
}
Visual Basic .NET Code Example
Public Class MyContainer
Inherits RenderingTemplateContainer
Private ReadOnly obj As Object
Public Sub New(ByVal obj As Object)
Me.obj = obj
End Sub
Public ReadOnly Property DataItem() As Object
Get
Return obj
End Get
End Property
End Class
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
The Microsoft.SharePoint.WebControls.RenderingTemplateContainer class inherits from the System.Web.UI.IDataItemContainer interface for data item object identification as well as the System.Web.UI.Control class in order to define an ASP.NET server control. The RenderingTemplateContainer represents an individual container data item within a RenderingTemplate.
RenderingTemplateContainer works through the use of three properties.
RenderingTemplateContainer.DataItem – Represents an individual data item bound with the RenderingTemplate
RenderingTemplateContainer.DataItemIndex – Represents the index of the data item
RenderingTemplateContainer. DisplayIndex – Represents the position of the item as displayed with the RenderingTemplate
The Usage Scenario
The primary use of RenderingTemplateContainer is internal, having representation in SPCalendar* classes. However, it is possible to use RenderingTemplateContainer as a base class within custom development.
In the below, the MyContainer class is inheriting from the RenderingTemplateContainer class. I am declaring a global object type variable which represents the data item.
C# Code Example
public class MyContainer : RenderingTemplateContainer
{
private readonly object obj;
public MyContainer(object obj)
{
this.obj = obj;
}
public object DataItem
{
get
{
return obj;
}
}
}
Visual Basic .NET Code Example
Public Class MyContainer
Inherits RenderingTemplateContainer
Private ReadOnly obj As Object
Public Sub New(ByVal obj As Object)
Me.obj = obj
End Sub
Public ReadOnly Property DataItem() As Object
Get
Return obj
End Get
End Property
End Class
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
- 6/3/2010
- Adam Buenz - MVP