码迷,mamicode.com
首页 > Web开发 > 详细

.Net 中使用Farpoint Web Spread 自定义CellType

时间:2017-12-05 13:19:22      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:point   例子   ide   end   object   htm   col   总结   pre   

网上关于Farpoint的文章不多,自己开发中有用到,写来总结一下。

FarPoint.Web.Spread可以在单元格中控制自己需要的CellType。 但有时候我们所面对的需求五花八门,可能它自带的CellType并不能满足我们的需要,这时,我们就可以选择自定义CellType。

一个自定义的HtmlInputButtonCellType的例子:

<Serializable()> Public Class PINButtonCellType
    Inherits FarPoint.Web.Spread.BaseCellType

    Public Value As String
    Public OnClick As String

    Public Overrides Function PaintCell(ByVal id As String, ByVal parent As TableCell, ByVal style As FarPoint.Web.Spread.Appearance, ByVal margin As FarPoint.Web.Spread.Inset, ByVal val As Object, ByVal ul As Boolean) As System.Web.UI.Control
        ‘Manual realize JS function on client FpCellType value + _getValue(rd) _setEditorValue(ed, val) _getEditorValue(ed) _setValue(rd,val)
        parent.Attributes.Add("FpCellType", "PINButtonCellType")
        Dim lit As New System.Web.UI.HtmlControls.HtmlInputButton
        lit.Value = Value
        lit.Attributes.Add("onclick", String.Format(OnClick, val))
        Return lit
    End Function

    Public Overrides Function GetEditorControl(ByVal id As String, ByVal tc As TableCell, ByVal style As FarPoint.Web.Spread.Appearance, ByVal margin As FarPoint.Web.Spread.Inset, ByVal v As Object, ByVal ul As Boolean) As System.Web.UI.Control
        Return Nothing
    End Function

    Public Overrides Function GetEditorValue(ByVal owner As Control, ByVal id As String) As Object
        Return MyBase.GetEditorValue(owner, id)
    End Function

    Public Overrides Function Format(ByVal o As Object) As String
        Format = MyBase.Format(o)
    End Function

    Public Overrides Function Parse(ByVal s As String) As Object
        Parse = MyBase.Parse(s)
    End Function

    Public Function GetValueFromText(ByVal s As String) As Object
        GetValueFromText = s
    End Function
End Class

使用示例:

Dim btnCellType As New PINButtonCellType
btnCellType.Value = "Reset" ‘button name
btnCellType.OnClick = "ResetRadio(this)" ‘onclick function
fpsDemo.ActiveSheetView.Columns(0).CellType = btnCellType

 

.Net 中使用Farpoint Web Spread 自定义CellType

标签:point   例子   ide   end   object   htm   col   总结   pre   

原文地址:http://www.cnblogs.com/jasonery/p/7986233.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!