作成日: 2020/05/08 最終更新日: 2020/08/26
文書種別
不具合
状況
修正済み
詳細
親階層および子階層からなる階層グリッドを作成すると、コントロールのボタンがクリックされたときに発生するRowCommandイベント内で、子階層のセルの値が取得できません。
回避方法
この問題は2020J v2(4.5.20202.332)で修正されました。
※修正版を適用しない場合の回避方法は以下の通りです。
下記のようにRowCommandイベント内で、e.CommandSourceがC1DetailGridViewの場合には、一時的に生成したC1GridViewに明示的に値を設定する方法が考えられます。
Protected Sub fDataGrid_RowCommand(sender As Object, e As C1.Web.Wijmo.Controls.C1GridView.C1GridViewCommandEventArgs)
If e.CommandName = "select" Then
'コメントアウト
'Dim val = CType(e.CommandSource, C1GridView).Rows(0).Cells(1).Text
'=====回避策=====
Dim gridView = CType(e.CommandSource, C1GridView)
setTblCellColectionToDetailGridView(gridView, e)
Dim val = gridView.Rows(0).Cells(1).Text
'================
If TypeOf e.CommandSource Is C1DetailGridView Then
Dim value = CType(CType(e.CommandSource, C1DetailGridView).DataSource, DataTable).Rows(e.CommandArgument)("Value")
End If
End If
End Sub
'=====回避策=====
Private Function setTblCellColectionToDetailGridView(gridView As C1GridView, e As C1.Web.Wijmo.Controls.C1GridView.C1GridViewCommandEventArgs)
If TypeOf e.CommandSource Is C1DetailGridView Then
Dim dataTable = CType(CType(e.CommandSource, C1DetailGridView).DataSource, DataTable)
For i As Integer = 0 To gridView.Rows.Count - 1
For j As Integer = 0 To gridView.Rows(i).Cells.Count - 1
If j <> 0 Then 'Do not set Text for first Cell
gridView.Rows(i).Cells(j).Text = dataTable.Rows(i)(j)
End If
Next
Next
End If
End Function
'================
※修正版を適用しない場合の回避方法は以下の通りです。
下記のようにRowCommandイベント内で、e.CommandSourceがC1DetailGridViewの場合には、一時的に生成したC1GridViewに明示的に値を設定する方法が考えられます。
Protected Sub fDataGrid_RowCommand(sender As Object, e As C1.Web.Wijmo.Controls.C1GridView.C1GridViewCommandEventArgs)
If e.CommandName = "select" Then
'コメントアウト
'Dim val = CType(e.CommandSource, C1GridView).Rows(0).Cells(1).Text
'=====回避策=====
Dim gridView = CType(e.CommandSource, C1GridView)
setTblCellColectionToDetailGridView(gridView, e)
Dim val = gridView.Rows(0).Cells(1).Text
'================
If TypeOf e.CommandSource Is C1DetailGridView Then
Dim value = CType(CType(e.CommandSource, C1DetailGridView).DataSource, DataTable).Rows(e.CommandArgument)("Value")
End If
End If
End Sub
'=====回避策=====
Private Function setTblCellColectionToDetailGridView(gridView As C1GridView, e As C1.Web.Wijmo.Controls.C1GridView.C1GridViewCommandEventArgs)
If TypeOf e.CommandSource Is C1DetailGridView Then
Dim dataTable = CType(CType(e.CommandSource, C1DetailGridView).DataSource, DataTable)
For i As Integer = 0 To gridView.Rows.Count - 1
For j As Integer = 0 To gridView.Rows(i).Cells.Count - 1
If j <> 0 Then 'Do not set Text for first Cell
gridView.Rows(i).Cells(j).Text = dataTable.Rows(i)(j)
End If
Next
Next
End If
End Function
'================
旧文書番号
85546