Microsoft.SharePoint.WebCon ...


WorkflowForm Class (Microsoft.SharePoint.WebControls)

Namespace: Microsoft.SharePoint.WebControls
Assembly: Microsoft.SharePoint (in microsoft.sharepoint.dll)
Syntax

Visual Basic (Declaration)
<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel:=True)> _
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level:=AspNetHostingPermissionLevel.Minimal)> _
Public NotInheritable Class WorkflowForm
    Inherits FormComponent
Visual Basic (Usage)
Dim instance As WorkflowForm
C#
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
public sealed class WorkflowForm : FormComponent
Inheritance Hierarchy

System.Object
   System.Web.UI.Control
     Microsoft.SharePoint.WebControls.SPControl
       Microsoft.SharePoint.WebControls.TemplateBasedControl
         Microsoft.SharePoint.WebControls.FormComponent
          Microsoft.SharePoint.WebControls.WorkflowForm
Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also

Tags :


Community Content

Adam Buenz - MVP
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
Tags :

Page view tracker