WorkflowForm Class
Represents a work flow form container.
System.Object
System.Web.UI.Control
Microsoft.SharePoint.WebControls.SPControl
Microsoft.SharePoint.WebControls.TemplateBasedControl
Microsoft.SharePoint.WebControls.FormComponent
Microsoft.SharePoint.WebControls.WorkflowForm
System.Web.UI.Control
Microsoft.SharePoint.WebControls.SPControl
Microsoft.SharePoint.WebControls.TemplateBasedControl
Microsoft.SharePoint.WebControls.FormComponent
Microsoft.SharePoint.WebControls.WorkflowForm
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
WorkflowForm
Description
The Microsoft.SharePoint.WebControls.WorkflowForm sealed class inherits from the Microsoft.SharePoint.WebControls.FormComponent class which provides the derivation for Windows SharePoint Services form-rendering controls. The WorkflowForm codebase is trivial, calling the "GenericForm” rendering template by overriding the DefaultTemplateName string property. Within the GenericForm rendering template, the significant control being called is ListFieldIterator which overrides DefaultTemplateName string property specifying the "ListFieldIterator" rendering template. This control will render every field in an arbitrary SPListItem object, unless it is excluded. The exclusion is determined by the ListFieldIterator.IsFieldExcluded method. In order to handle any stylistic concerns, the table CSS class is specified “ms-formtable” which is analogous to other SharePoint list forms.
Usage Scenario
The primary use of WorkflowForm is internal, since it provides the default field display by recurring through all available fields for an arbitrary SPListItem context for workflow form initiation. Because the class is sealed, it is not possible to inherit and extend the class, because of this there is little use for the control within custom development. Being derived from FormComponent, it is feasible to use the control in the same fashion as other FormComponent objects.
In the below example, a switch statement is being used in order to test the FormMode of the current FormContext. If the FormMode is equal to SPControlMode.Display, then a new WorkflowForm object is created, set to a unique ID, and then added to the current instance control collection.
C# Code Example
public class MyClass : FormComponent
{
protected override void CreateChildControls()
{
switch (SPContext.Current.FormContext.FormMode)
{
case SPControlMode.Display:
{
WorkflowForm type = new WorkflowForm();
type.ID = "WorkflowForm";
Controls.Add(type);
}
break;
}
base.CreateChildControls();
}
}
VB. NET Code Example
Public Class [MyClass]
Inherits FormComponent
Protected Overloads Overrides Sub CreateChildControls()
Select Case SPContext.Current.FormContext.FormMode
Case SPControlMode.Display
If True Then
Dim type As New WorkflowForm()
type.ID = "WorkflowForm"
Controls.Add(type)
End If
Exit Select
End Select
MyBase.CreateChildControls()
End Sub
End Class
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
The Microsoft.SharePoint.WebControls.WorkflowForm sealed class inherits from the Microsoft.SharePoint.WebControls.FormComponent class which provides the derivation for Windows SharePoint Services form-rendering controls. The WorkflowForm codebase is trivial, calling the "GenericForm” rendering template by overriding the DefaultTemplateName string property. Within the GenericForm rendering template, the significant control being called is ListFieldIterator which overrides DefaultTemplateName string property specifying the "ListFieldIterator" rendering template. This control will render every field in an arbitrary SPListItem object, unless it is excluded. The exclusion is determined by the ListFieldIterator.IsFieldExcluded method. In order to handle any stylistic concerns, the table CSS class is specified “ms-formtable” which is analogous to other SharePoint list forms.
Usage Scenario
The primary use of WorkflowForm is internal, since it provides the default field display by recurring through all available fields for an arbitrary SPListItem context for workflow form initiation. Because the class is sealed, it is not possible to inherit and extend the class, because of this there is little use for the control within custom development. Being derived from FormComponent, it is feasible to use the control in the same fashion as other FormComponent objects.
In the below example, a switch statement is being used in order to test the FormMode of the current FormContext. If the FormMode is equal to SPControlMode.Display, then a new WorkflowForm object is created, set to a unique ID, and then added to the current instance control collection.
C# Code Example
public class MyClass : FormComponent
{
protected override void CreateChildControls()
{
switch (SPContext.Current.FormContext.FormMode)
{
case SPControlMode.Display:
{
WorkflowForm type = new WorkflowForm();
type.ID = "WorkflowForm";
Controls.Add(type);
}
break;
}
base.CreateChildControls();
}
}
VB. NET Code Example
Public Class [MyClass]
Inherits FormComponent
Protected Overloads Overrides Sub CreateChildControls()
Select Case SPContext.Current.FormContext.FormMode
Case SPControlMode.Display
If True Then
Dim type As New WorkflowForm()
type.ID = "WorkflowForm"
Controls.Add(type)
End If
Exit Select
End Select
MyBase.CreateChildControls()
End Sub
End Class
Adam Buenz
SharePoint Foundation MVP - http://www.sharepointsecurity.com
- 6/3/2010
- Adam Buenz - MVP