作成日: 2017/06/06 最終更新日: 2017/06/06
文書種別
使用方法
詳細
チェックボックス型セルのOnClientClickプロパティを使用することで、チェックボックスがクリックされたタイミングで独自のクライアント側スクリプト処理を実行することができます。
◎サンプルコード(VB)
◎サンプルコード(C#)
◎サンプルコード(VB)
------------------------
Webフォームクラス
------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
Return
End If
Dim chkbx As New FarPoint.Web.Spread.CheckBoxCellType()
chkbx.OnClientClick = "chkbxclick()"
FpSpread1.ActiveSheetView.Columns(0).CellType = chkbx
End Sub
---------------------------------
クライアント側スクリプト
---------------------------------
<script type="text/javascript">
function chkbxclick() {
var spread = document.getElementById("FpSpread1");
var row = spread.GetActiveRow();
spread.SetValue(row, 1, spread.GetValue(row, 0), true);
}
</script>
Webフォームクラス
------------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsPostBack Then
Return
End If
Dim chkbx As New FarPoint.Web.Spread.CheckBoxCellType()
chkbx.OnClientClick = "chkbxclick()"
FpSpread1.ActiveSheetView.Columns(0).CellType = chkbx
End Sub
---------------------------------
クライアント側スクリプト
---------------------------------
<script type="text/javascript">
function chkbxclick() {
var spread = document.getElementById("FpSpread1");
var row = spread.GetActiveRow();
spread.SetValue(row, 1, spread.GetValue(row, 0), true);
}
</script>
◎サンプルコード(C#)
------------------------
Webフォームクラス
------------------------
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
return;
}
FarPoint.Web.Spread.CheckBoxCellType chkbx = new FarPoint.Web.Spread.CheckBoxCellType();
chkbx.OnClientClick = "chkbxclick()";
FpSpread1.ActiveSheetView.Columns[0].CellType = chkbx;
}
-------------------------------
クライアント側スクリプト
-------------------------------
VBのサンプルコードで紹介しているものと同様です。
Webフォームクラス
------------------------
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
return;
}
FarPoint.Web.Spread.CheckBoxCellType chkbx = new FarPoint.Web.Spread.CheckBoxCellType();
chkbx.OnClientClick = "chkbxclick()";
FpSpread1.ActiveSheetView.Columns[0].CellType = chkbx;
}
-------------------------------
クライアント側スクリプト
-------------------------------
VBのサンプルコードで紹介しているものと同様です。
旧文書番号
40383