分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 软件开发

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

发布时间:2023-09-06 01:28责任编辑:沈小雨关键词:Web

网上关于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 FunctionEnd Class

使用示例:

Dim btnCellType As New PINButtonCellTypebtnCellType.Value = "Reset" ‘button namebtnCellType.OnClick = "ResetRadio(this)" ‘onclick functionfpsDemo.ActiveSheetView.Columns(0).CellType = btnCellType

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

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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved