wjj_123 你好,设置方法如下:
- protected override void Render(HtmlTextWriter writer)
- {
- Table spreadTable = this.FpSpread1.FindControl("viewport") as Table;
- spreadTable.Attributes.Add("onclick", ClientScript.GetPostBackEventReference(FpSpread1, "click,-1,-1") + "; return false;");
- spreadTable.Attributes.Add("ondblclick", ClientScript.GetPostBackEventReference(FpSpread1, "doubleclick,-1,-1") + "; return false;");
- base.Render(writer);
- }
- protected void FpSpread1_ButtonCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
- {
- int activerow=this.FpSpread1.Sheets[0].ActiveRow;
- int activecol=this.FpSpread1.Sheets[0].ActiveColumn;
- if (e.CommandName=="click")
- {
- FarPoint.Web.Spread.ComboBoxCellType comboCellType = new FarPoint.Web.Spread.ComboBoxCellType();
- comboCellType.ShowButton = true;
- this.FpSpread1.Sheets[0].Cells[activerow, activecol].CellType = comboCellType;
- }
- if (e.CommandName=="doubleclick")
- {
- FarPoint.Web.Spread.TextCellType textCellType = new FarPoint.Web.Spread.TextCellType();
- textCellType.ShowEditor = true;
- this.FpSpread1.Sheets[0].Cells[activerow, activecol].CellType = textCellType;
- }
- }
复制代码 |