elwin 你好,
这个 Case 实现的方法为:通过 Rows.Locked 锁定该行,不可编辑实现,在 DeleteCommand 删除事件中判断行索引,从而判断是否删除。请参考代码:- protected void Page_Load(object sender, EventArgs e)
- {
- DataTable data = new DataTable();
- DataColumn col1 = new DataColumn("1", typeof(System.String));
- DataColumn col2 = new DataColumn("2", typeof(System.String));
- data.Columns.Add(col1);
- data.Columns.Add(col2);
- data.Rows.Add("1", "1");
- data.Rows.Add("2", "2");
- this.FpSpread1.Sheets[0].DataSource = data;
- this.FpSpread1.Sheets[0].Rows[0].Locked = true;
- this.FpSpread1.Sheets[0].AllowDelete = true;
- }
- protected void FpSpread1_DeleteCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
- {
- if (Convert.ToInt32(e.CommandArgument)==0)
- {
- e.Handled = true;
- }
- }
复制代码 |