找回密码
 立即注册

QQ登录

只需一步,快速开始

sxjcjwl

银牌会员

9

主题

27

帖子

3249

积分

银牌会员

积分
3249

活字格认证

sxjcjwl
银牌会员   /  发表于:2011-12-5 14:56  /   查看:5356  /  回复:1
当表格列单元格类型设置为  combobox时,并加载选项。表格列的单元格已有值,触发单元格弹出combobox时,怎么样使得combobox的下拉选项中选定的项的文本与单元格的值一致。

1 个回复

倒序浏览
iceman
社区贡献组   /  发表于:2011-12-5 15:28:00
沙发

回复 1# sxjcjwl 的帖子

sxjcjwl 你好,下面以 Cell[0,0] 为例实现 ComboboxCellType 单元格类型的 Items 和 Cell Text 同步。这是我实现的代码:

  1.     FarPoint.Web.Spread.ComboBoxCellType comboboxType = new FarPoint.Web.Spread.ComboBoxCellType();
  2.         protected void Page_Load(object sender, EventArgs e)
  3.         {
  4.             this.FpSpread1.ActiveSheetView.AutoPostBack = true;
  5.             FpSpread1.ActiveSheetView.Cells[0, 0].Text = "1";
  6.             FpSpread1.ActiveSheetView.Cells[0, 0].CellType = comboboxType;
  7.         }
  8. //在 CellClick 事件中实现文本与单元格值的绑定
  9.      private void GetItems(FarPoint.Web.Spread.FpSpread spread,         protected void FpSpread1_CellClick(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
  10.         {
  11.             string item = this.FpSpread1.ActiveSheetView.Cells[0, 0].Text;
  12.             string[] array = new string[1] { item };
  13.             comboboxType.Items = array;
  14.         }
复制代码
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部