回复 1楼houdawei的帖子
我是通过以下方法添加 LinkButton 的,如果需要参数不同,那么需要设置多个 CellType,制定不同的 CommandName 才能实现:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- DataTable dt = new DataTable();
- dt.Columns.Add("col1", typeof(string));
- dt.Rows.Add("1");
- dt.Rows.Add("1");
- dt.Rows.Add("1");
- dt.Rows.Add("1");
- //this.FpSpread1.ActiveSheetView.AutoGenerateColumns = false;
- //this.FpSpread1.ActiveSheetView.DataAutoCellTypes = false;
- this.FpSpread1.ActiveSheetView.DataSource = dt;
- this.FpSpread1.ActiveSheetView.Columns.Add(0, 1);
- FarPoint.Web.Spread.ButtonCellType linkButton = new FarPoint.Web.Spread.ButtonCellType();
- linkButton.ButtonType = FarPoint.Web.Spread.ButtonType.LinkButton;
- linkButton.CommandName = "MyCommand";
- FpSpread1.Sheets[0].Columns[0].CellType = linkButton;
- }
复制代码 |