Spread ASP.NET 15
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / SheetStyleProperty Class / Editor Field
Example


In This Topic
    Editor Field
    In This Topic
    Represents the Editor property (index of 2) for the editor of the sheet style.
    Syntax
    'Declaration
     
    Public Shared ReadOnly Editor As SheetStyleProperty
    'Usage
     
    Dim value As SheetStyleProperty
     
    value = SheetStyleProperty.Editor
    public static readonly SheetStyleProperty Editor
    Example
    <Serializable()> 
    public class myeditor : FarPoint.Web.Spread.Editor.GeneralEditor
    {
    public override Control GetEditorControl(string id, TableCell parent, FarPoint.Web.Spread.Appearance style, FarPoint.Web.Spread.Inset
    margin, object value, bool upperLevel) 
        { 
        TextBox mytextbox; 
        Control c; 
        c = base.GetEditorControl(id, parent, style, margin, value, upperLevel); 
        mytextbox = (TextBox) c; 
        mytextbox.MaxLength = 5; 
        return mytextbox; 
        } 
    }
    
    FarPoint.Web.Spread.StyleInfo si = new FarPoint.Web.Spread.StyleInfo("DataAreaDefault");
    si.Editor = new myeditor();
    FpSpread1.ActiveSheetView.DefaultStyle = si;
    bool b = false;
    if (IsPostBack)
    {
            b = si.IsPropertySet(FarPoint.Web.Spread.SheetStyleProperty.Editor);
    }
    if (b)
    {
            Response.Write("The editor has been set.");
    }
    
    <Serializable()> 
    Public Class myeditor
    Inherits FarPoint.Web.Spread.Editor.GeneralEditor
    
    
    Public Overrides ReadOnly Property EditorClientScriptUrl() As String
        Get
            Return MyBase.EditorClientScriptUrl()
        End Get
    End Property
    
    Public Overrides Function GetEditorControl(ByVal id As String, ByVal parent As System.Web.UI.WebControls.TableCell, ByVal
    style As FarPoint.Web.Spread.Appearance, ByVal margin As FarPoint.Web.Spread.Inset, ByVal value As Object, ByVal upperLevel
    As Boolean) As System.Web.UI.Control
        Dim c As Control = MyBase.GetEditorControl(id, parent, style, margin, value, upperLevel)
        Dim tb As New TextBox
        tb = CType(c, TextBox)
        tb.MaxLength = 5
        Return tb
    End Function
    
    Public Overrides Function GetEditorValue(ByVal owner As System.Web.UI.Control, ByVal id As String) As Object
        Return MyBase.GetEditorValue(owner, id)
    End Function
    
    Public Overrides Function GetValidator() As System.Web.UI.WebControls.BaseValidator
        Return MyBase.GetValidator()
    End Function
    
    Public Overrides Function ValidateEditorValue(ByVal value As Object) As String
        Return MyBase.ValidateEditorValue(value)
    End Function
    End Class
    
    Dim s As FarPoint.Web.Spread.SheetStyleProperty
    Dim si As New FarPoint.Web.Spread.StyleInfo("DataAreaDefault")
    si.Editor = New myeditor
    FpSpread1.ActiveSheetView.DefaultStyle = si
    Dim b As Boolean
    If IsPostBack Then
        b = si.IsPropertySet(s.Editor)
        If b Then
            Response.Write("The editor has been set.")
        End If
    End If
    See Also