protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
//コンボボックス型セルを設定します
ComboBoxCellType cbCell = new ComboBoxCellType()
{
Items = new string[] { "要素1", "要素2", "要素3" },
Values = new string[] { "1", "2", "3" },
UseValue = true
};
FpSpread1.Cells[0, 1].CellType = cbCell;
}
protected void FpSpread1_UpdateCommand(object sender, SpreadCommandEventArgs e)
{
//変更された行ごとにUpdateCommandイベントが発生します
//EditValues配列には1行分の値が含まれています
//コンボボックス(2列目:インデックス「1」)が変更されたか調べます
if (!object.ReferenceEquals(e.EditValues[1], FpSpread.Unchanged))
{
System.Diagnostics.Debug.WriteLine(string.Format("選択されたコンボボックスの値:{0}", e.EditValues[1]));
}
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then Return
'コンボボックス型セルを設定します
Dim cbCell As New ComboBoxCellType() With {
.Items = New String() {"要素1", "要素2", "要素3"},
.Values = New String() {"1", "2", "3"},
.UseValue = True
}
FpSpread1.Cells(0, 1).CellType = cbCell
End Sub
Protected Sub FpSpread1_UpdateCommand(sender As Object, e As SpreadCommandEventArgs) Handles FpSpread1.UpdateCommand
'変更された行ごとにUpdateCommandイベントが発生します
'EditValues配列には1行分の値が含まれています
'コンボボックス(2列目:インデックス「1」)が変更されたか調べます
If Not Object.ReferenceEquals(e.EditValues(1), FpSpread.Unchanged) Then
System.Diagnostics.Debug.WriteLine(String.Format("選択されたコンボボックスの値:{0}", e.EditValues(1)))
End If
End Sub