home5p 你好,可以通过 ComboBoxCellType 属性AutoPostBack 和 FpSpread 事件 ButtonCommand 实现该功能,请参考代码片段:
- protected void Page_Load(object sender, EventArgs e)
- {
- FarPoint.Web.Spread.ComboBoxCellType c1 = new FarPoint.Web.Spread.ComboBoxCellType();
- c1.AutoPostBack = true;
- c1.ShowButton = true;
- c1.AutoPostBack = true;
- string[] items = new string[2] { "1", "2" };
- c1.Items = items;
- FpSpread1.ActiveSheetView.Cells[0, 0].CellType = c1;
- FarPoint.Web.Spread.ComboBoxCellType c2 = new FarPoint.Web.Spread.ComboBoxCellType();
- c2.ShowButton = true;
- c2.AutoPostBack = true;
- c2.Items = items;
- FpSpread1.ActiveSheetView.Cells[0, 1].CellType = c2;
- }
- protected void FpSpread1_ButtonCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
- {
- if (e.SheetView.Cells[0,0].Text=="1")
- {
- FpSpread1.ActiveSheetView.Cells[0, 1].Locked = false;
- }
- else if (e.SheetView.Cells[0,0].Text=="2")
- {
- FpSpread1.ActiveSheetView.Cells[0, 1].Locked = true;
- }
- }
复制代码 |