【セル型】コードでチェックボックス型セルのチェックをつけたい
対象製品
SPREAD for ASP.NET 8.0J
詳細
セルのValue プロパティにより、チェックボックスにチェックをつけたり外したりすることができます。
◎サンプルコード(VB)
◎サンプルコード(C#)
◎サンプルコード(VB)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
Return
End If
Dim c As New FarPoint.Web.Spread.CheckBoxCellType
FpSpread1.ActiveSheetView.Cells(1, 1).CellType = c
FpSpread1.ActiveSheetView.Cells(1, 1).Value = True
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
' クライアントの変更を確定します
FpSpread1.SaveChanges()
FpSpread1.ActiveSheetView.Cells(1, 1).Value = False
End Sub
If IsPostBack Then
Return
End If
Dim c As New FarPoint.Web.Spread.CheckBoxCellType
FpSpread1.ActiveSheetView.Cells(1, 1).CellType = c
FpSpread1.ActiveSheetView.Cells(1, 1).Value = True
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
' クライアントの変更を確定します
FpSpread1.SaveChanges()
FpSpread1.ActiveSheetView.Cells(1, 1).Value = False
End Sub
◎サンプルコード(C#)
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
return;
}
FarPoint.Web.Spread.CheckBoxCellType c = new FarPoint.Web.Spread.CheckBoxCellType();
FpSpread1.ActiveSheetView.Cells[1, 1].CellType = c;
FpSpread1.ActiveSheetView.Cells[1, 1].Value = true;
}
protected void Button1_Click(object sender, EventArgs e)
{
// クライアントの変更を確定します
FpSpread1.SaveChanges();
FpSpread1.ActiveSheetView.Cells[1, 1].Value = false;
}
{
if (Page.IsPostBack)
{
return;
}
FarPoint.Web.Spread.CheckBoxCellType c = new FarPoint.Web.Spread.CheckBoxCellType();
FpSpread1.ActiveSheetView.Cells[1, 1].CellType = c;
FpSpread1.ActiveSheetView.Cells[1, 1].Value = true;
}
protected void Button1_Click(object sender, EventArgs e)
{
// クライアントの変更を確定します
FpSpread1.SaveChanges();
FpSpread1.ActiveSheetView.Cells[1, 1].Value = false;
}
キーワード
セル型