找回密码
 立即注册

QQ登录

只需一步,快速开始

jxsgood

中级会员

15

主题

43

帖子

521

积分

中级会员

积分
521

活字格认证微信认证勋章

jxsgood
中级会员   /  发表于:2011-11-3 23:55  /   查看:9361  /  回复:6

1068992961230.jpg (78.15 KB, 下载次数: 790)

6 个回复

正序浏览
iceman
社区贡献组   /  发表于:2011-11-7 10:32:00
7#

回复 1# jxsgood 的帖子

链接:http://gcdn.grapecity.com/showtopic-2528.html
回答:你好,不好意思,由于我的失误,之前没有和你确定 Spread 版本,给你带来不便,非常抱歉。
Spread 4.0 中 RadioButtonListCellType  没有 OnClientClick  属性。
你可以自定义继承 RadioButtonListCellType  的单元格类型,重载 PaintCell 方法实现绑定按钮事件,设置如下:
后台代码:

  1.    public partial class WebForm3 : System.Web.UI.Page
  2.      {
  3.         protected void Page_Load(object sender, EventArgs e)
  4.         {
  5.             string[] items = new string[] {"1","2"};
  6.             myRadioButtonList rbl = new myRadioButtonList(items);
  7.             FpSpread1.ActiveSheetView.Cells[0, 0].CellType = rbl;

  8.         }
  9.     }
  10.     public class myRadioButtonList : FarPoint.Web.Spread.RadioButtonListCellType
  11.     {
  12.         string[] _myList;
  13.         public myRadioButtonList(string[] items)
  14.         {
  15.             _myList = items;
  16.         }
  17.         public override Control PaintCell(string id, TableCell parent, FarPoint.Web.Spread.Appearance style, FarPoint.Web.Spread.Inset margin, object value, bool upperLevel)
  18.         {
  19.             RadioButtonList myRadioButtonList = new RadioButtonList();
  20.             myRadioButtonList = base.PaintCell(id, parent, style, margin, value, upperLevel) as RadioButtonList;
  21.             foreach (string myitem in _myList)
  22.             {
  23.                 myRadioButtonList.Items.Add(myitem);
  24.             }
  25.             myRadioButtonList.Attributes.Add("onclick", "test()");
  26.             return myRadioButtonList;
  27.         }
  28.     }
复制代码
前台代码:

  1.     <script type="text/javascript">
  2.         function test() {
  3.             alert("test");
  4.         }
  5.     </script>
复制代码
回复 使用道具 举报
jxsgood
中级会员   /  发表于:2011-11-4 20:16:00
6#
晕死了:

for asp.net V4 版本中
RadioButtonListCellType 居然没有找到OnClientClick 属性,请版主确认下!
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2011-11-4 18:58:00
5#

回复 4# wp_pandy 的帖子

同样也很看好你~哈哈
回复 使用道具 举报
wp_pandy
高级会员   /  发表于:2011-11-4 18:23:00
地板
哈哈,支持
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2011-11-4 14:48:00
板凳

回复 1# jxsgood 的帖子

你好,
首先,为了方便更多的用户能够的下载你的 Demo ,在没有和你沟通的情况下修改了 Demo 的链接,在这里希望你谅解。如果以后再次出现 Demo 过大上传失败的情况,请联系我们,我们很愿意协助你完成精彩知识的发布。:share:

同时,你的陈述非常详尽精彩,相信对其他用户会有很大的帮助。我们已经把你的帖子加为精华文章,并且发布在知识库与精华区。这个月起,为了感谢广大用户的支持,我们论坛将要举办论坛之星评选活动,会评选出一些在论坛中积极活跃的用户,到时会有小礼品赠送,我很看好你奥。

我们期待更多的用户能够参与进来,你的加入使我们更精彩。:strong:
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2011-11-4 14:43:00
沙发
你好,可以使用 RadioButtonListCellType 下的 OnClientClick 属性给 RadioButton 挂前台事件。
后台代码:

  1. FarPoint.Web.Spread.RadioButtonListCellType rbl = new FarPoint.Web.Spread.RadioButtonListCellType();
  2. rbl.OnClientClick = "test();";
  3. FarPoint.Web.Spread.ListItem[] items = new FarPoint.Web.Spread.ListItem[2];
  4. FarPoint.Web.Spread.ListItem item = new FarPoint.Web.Spread.ListItem();
  5. item.Text = "A";
  6. item.Value = "1";
  7. items[0] = item;
  8. item = new FarPoint.Web.Spread.ListItem();
  9. item.Text = "B";
  10. item.Value = "2";
  11. items[1] = item;
  12. rbl.ListItems = items;
  13. FpSpread1.ActiveSheetView.Cells[0, 0].CellType = rbl;
复制代码
前台代码:

  1. <script type="text/javascript">
  2. function test() {
  3. FpSpread1.UpdatePostbackData();
  4. FpSpread1.Update();
  5. alert("test");
  6. }
  7. </script>
复制代码
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部