在下拉菜单如何取取到选择项的值:
见下面代码:
FarPoint.Web.Spread.ComboBoxCellType cmb = new FarPoint.Web.Spread.ComboBoxCellType();
cmb.Items = new string[] { "上班", "下基层"};
cmb.Values = new string[] { "1","2"};
this.FpSpread1.ActiveSheetView.Columns[4].CellType = cmb;
this.FpSpread1.ActiveSheetView.Columns[4].Editor = cmb;
用户选择下拉菜单后,点击更新按钮:见代码:
protected void FpSpread1_UpdateCommand(object sender, FarPoint.Web.Spread.SpreadCommandEventArgs e)
{
//更新动作
int currentRow = (int)e.CommandArgument;
System.Collections.ArrayList array = e.EditValues;
for (int i = 0; i < array.Count; i++)
{
//e.SheetView.Cells[Convert.ToInt32(e.CommandArgument),4].Value
if (array.ToString() != "System.Object")
{
int id = int.Parse(e.SheetView.Cells[Convert.ToInt32(e.CommandArgument), 0].Text);
FarPoint.Web.Spread.ComboBoxCellType cmb = this.FpSpread1.Sheets[0].Cells[currentRow, 4].CellType as FarPoint.Web.Spread.ComboBoxCellType;
int values = Convert.ToInt32(e.SheetView.Cells[Convert.ToInt32(e.CommandArgument), 4].Value);
//other coder.....
}
}
} |
|