Microsoft.SharePoint.WebCon ...


RatingScaleField 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 Class RatingScaleField
    Inherits BaseFieldControl
Visual Basic (Usage)
Dim instance As RatingScaleField
C#
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel=true)] 
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)] 
public class RatingScaleField : BaseFieldControl
Inheritance Hierarchy

System.Object
   System.Web.UI.Control
     Microsoft.SharePoint.WebControls.SPControl
       Microsoft.SharePoint.WebControls.TemplateBasedControl
         Microsoft.SharePoint.WebControls.FormComponent
           Microsoft.SharePoint.WebControls.FieldMetadata
             Microsoft.SharePoint.WebControls.BaseFieldControl
              Microsoft.SharePoint.WebControls.RatingScaleField
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

Thomas Lee
RatingScaleField

Description

The Microsoft.SharePoint.WebControls.RatingScaleField class inherits from the Microsoft.SharePoint.WebControls.BaseFieldControl class which represents a field through the use of child controls on a form page within SharePoint. RatingScaleField is used within the shipped software as a support field for surveys in order to provide user defined ratings through System.Web.UI.WebControls.RadioButton controls. The number of RadioButton controls used is determined by the number of choices. The Microsoft.SharePoint.SPFieldRatingScaleValue class is used to represent values, and the Microsoft.SharePoint.SPFieldRatingScale is corresponds to a rating scale field type.

Usage Scenario

The primary usage of RatingScaleField is to support shipped SharePoint survey functionality, and is rarely used otherwise unless extending native survey operations with a custom field type. However, as an orthodox SharePoint field control it is feasible to use in a customary field fashion due to the control reliance of Microsoft.SharePoint.WebControls.BaseFieldControl for inheritance.

In the below example, the MyClass class inherits from Microsoft.SharePoint.SPFieldMultiChoice, implementing the appropriate constructors with relevant parameters when required. Following, there is overriding of the FieldRenderingControl property. Next, a new Microsoft.SharePoint.WebControls.BaseFieldControl object is being created set to instantiate as a Microsoft.SharePoint.WebControls.RatingScaleField type. Following, the BaseFieldControl.FieldName property is being set to the SPField.InternalName property, and the control is being returned.

C# Code Example

public class MyClass : SPFieldMultiChoice
{
public MyClass(SPFieldCollection fields, string fieldName) : base(fields, fieldName)
{
}
public MyClass(SPFieldCollection fields, string typeName, string displayName) : base(fields, typeName, displayName)
{
}
public override BaseFieldControl FieldRenderingControl
{
get
{
BaseFieldControl control = new RatingScaleField();
control.FieldName = InternalName;
return control;
}
}
}

VB.NET Code Example

Public Class [MyClass]
Inherits SPFieldMultiChoice
Public Sub New(ByVal fields As SPFieldCollection, ByVal fieldName As String)
MyBase.New(fields, fieldName)
End Sub
Public Sub New(ByVal fields As SPFieldCollection, ByVal typeName As String, ByVal displayName As String)
MyBase.New(fields, typeName, displayName)
End Sub
Public Overloads Overrides ReadOnly Property FieldRenderingControl() As BaseFieldControl
Get
Dim control As BaseFieldControl = New RatingScaleField()
control.FieldName = InternalName
Return control
End Get
End Property
End Class



Page view tracker