回复 1楼raul1122的帖子
1.可指定某几列允许修改
可以设置不可修改的列 Locked 属性为true;
- this.FpSpread1.Sheets[0].Columns[1].Locked = true;
复制代码
2.如该列是下拉框的话,可绑定加载的数据源,修改时可进行选择
我理解是需要指定 Combo 的数据源,是否正确?参考代码:
- protected void Page_Load(object sender, EventArgs e)
- {
- if (IsPostBack)
- {
- return;
- }
- this.FpSpread1.Sheets[0].Columns[1].Locked = true;
- FarPoint.Web.Spread.ComboBoxCellType cb=new FarPoint.Web.Spread.ComboBoxCellType();
- DataSet dsType = GetDataSet();//testServer.SelOtherType();
- FarPoint.Web.Spread.ComboBoxCellType oblistCell = new FarPoint.Web.Spread.ComboBoxCellType();
- oblistCell.AllowWrap = true;
- oblistCell.ShowButton = true;
- oblistCell.DataSource = dsType;
- oblistCell.DataTextField = "uType";
- oblistCell.DataValueField = "uType";
- oblistCell.UseValue = true;
- oblistCell.AutoPostBack = true;
- this.FpSpread1.Sheets[0].Columns[1].CellType = oblistCell;
- }
- /// <summary>
- /// 设置数据源
- /// </summary>
- /// <returns>ComboBoxCellType 使用的数据源</returns>
- private DataSet GetDataSet()
- {
- DataSet ds = new System.Data.DataSet();
- DataTable name;
- name = ds.Tables.Add("Heros");
- name.Columns.AddRange(new DataColumn[] { new DataColumn("uType", typeof(string)), new DataColumn("ID", typeof(Int32)) });
- name.Rows.Add(new object[] { "选项一", 0 });
- name.Rows.Add(new object[] { "选项二", 1 });
- return ds;
- }
复制代码
3.修改完毕后,点击按钮可保存修改的数据
通过 UpdateCommand 获取,参考链接:http://blog.gcpowertools.com.cn/ ... et_usecommands.aspx |