链接:http://gcdn.grapecity.com/showtopic-2528.html
回答:你好,不好意思,由于我的失误,之前没有和你确定 Spread 版本,给你带来不便,非常抱歉。
Spread 4.0 中 RadioButtonListCellType 没有 OnClientClick 属性。
你可以自定义继承 RadioButtonListCellType 的单元格类型,重载 PaintCell 方法实现绑定按钮事件,设置如下:
后台代码:
- public partial class WebForm3 : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- string[] items = new string[] {"1","2"};
- myRadioButtonList rbl = new myRadioButtonList(items);
- FpSpread1.ActiveSheetView.Cells[0, 0].CellType = rbl;
- }
- }
- public class myRadioButtonList : FarPoint.Web.Spread.RadioButtonListCellType
- {
- string[] _myList;
- public myRadioButtonList(string[] items)
- {
- _myList = items;
- }
- public override Control PaintCell(string id, TableCell parent, FarPoint.Web.Spread.Appearance style, FarPoint.Web.Spread.Inset margin, object value, bool upperLevel)
- {
- RadioButtonList myRadioButtonList = new RadioButtonList();
- myRadioButtonList = base.PaintCell(id, parent, style, margin, value, upperLevel) as RadioButtonList;
- foreach (string myitem in _myList)
- {
- myRadioButtonList.Items.Add(myitem);
- }
- myRadioButtonList.Attributes.Add("onclick", "test()");
- return myRadioButtonList;
- }
- }
复制代码 前台代码:
- <script type="text/javascript">
- function test() {
- alert("test");
- }
- </script>
复制代码 |