protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
//ボタン型セルを設定します
ButtonCellType btnCell = new ButtonCellType() { CommandName = "MyBtnClick" };
FpSpread1.Cells[0, 1].CellType = btnCell;
}
protected void FpSpread1_ButtonCommand(object sender, SpreadCommandEventArgs e)
{
//CommandNameでボタンを識別します
if (e.CommandName == "MyBtnClick")
{
//セルの位置を取得します
System.Drawing.Point cellPos = (System.Drawing.Point)e.CommandArgument;
System.Diagnostics.Debug.WriteLine(string.Format("クリック位置:Cell[{0}, {1}]", cellPos.X, cellPos.Y));
}
}
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then Return
'ボタン型セルを設定します
Dim btnCell As New ButtonCellType() With {.CommandName = "MyBtnClick"}
FpSpread1.Cells(0, 1).CellType = btnCell
End Sub
Protected Sub FpSpread1_ButtonCommand(sender As Object, e As SpreadCommandEventArgs) Handles FpSpread1.ButtonCommand
'CommandNameでボタンを識別します
If e.CommandName = "MyBtnClick" Then
'セルの位置を取得します
Dim cellPos As System.Drawing.Point = DirectCast(e.CommandArgument, System.Drawing.Point)
System.Diagnostics.Debug.WriteLine(String.Format("クリック位置:Cell[{0}, {1}]", cellPos.X, cellPos.Y))
End If
End Sub