找回密码
 立即注册

QQ登录

只需一步,快速开始

home5p
论坛元老   /  发表于:2011-11-30 14:31:00
7#
测试了,成功了,谢谢
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2011-11-29 19:17:00
6#

回复 5# home5p 的帖子

home5p 你好,请在 onDataChanged 事件中添加:
  1.                     FpSpread1.UpdatePostbackData();
  2.                     FpSpread1.CallBack("Update");
复制代码
回复 使用道具 举报
home5p
论坛元老   /  发表于:2011-11-29 17:21:00
5#
这个方式试过是可行的,想接著问,我有设一个隐藏栏位,预设是"",
第一个ComboBoxCellType的选项有变动时,利用java script的 onDataChanged 把隐藏栏位的值改成"U",
存档时,判断隐藏栏位是"U"时才写进DB里,把二个ComboBoxCellType 属性AutoPostBack=true后,
好像 onDataChanged 就没有作用了,所以变成一直无法将资料更新回DB
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2011-11-29 16:29:00
地板

回复 3# home5p 的帖子

:share: 客气了~
回复 使用道具 举报
home5p
论坛元老   /  发表于:2011-11-29 16:05:00
板凳
受教了,谢谢
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2011-11-29 15:40:00
沙发

回复 1# home5p 的帖子

home5p 你好,可以通过 ComboBoxCellType 属性AutoPostBack   和 FpSpread 事件 ButtonCommand 实现该功能,请参考代码片段:

  1.   protected void Page_Load(object sender, EventArgs e)
  2.         {
  3.             FarPoint.Web.Spread.ComboBoxCellType c1 = new FarPoint.Web.Spread.ComboBoxCellType();
  4.             c1.AutoPostBack = true;
  5.             c1.ShowButton = true;
  6.             c1.AutoPostBack = true;
  7.             string[] items = new string[2] { "1", "2" };
  8.             c1.Items = items;
  9.             FpSpread1.ActiveSheetView.Cells[0, 0].CellType = c1;

  10.             FarPoint.Web.Spread.ComboBoxCellType c2 = new FarPoint.Web.Spread.ComboBoxCellType();
  11.             c2.ShowButton = true;
  12.             c2.AutoPostBack = true;
  13.             c2.Items = items;
  14.             FpSpread1.ActiveSheetView.Cells[0, 1].CellType = c2;

  15.         }

  16.         protected void FpSpread1_ButtonCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
  17.         {
  18.             if (e.SheetView.Cells[0,0].Text=="1")
  19.             {
  20.                 FpSpread1.ActiveSheetView.Cells[0, 1].Locked = false;
  21.             }
  22.             else if (e.SheetView.Cells[0,0].Text=="2")
  23.             {
  24.                 FpSpread1.ActiveSheetView.Cells[0, 1].Locked = true;
  25.             }
  26.         }
复制代码
回复 使用道具 举报
12
您需要登录后才可以回帖 登录 | 立即注册
返回顶部