vb.net - 如何在运行时更新 Janus GridEx 复选框
问题描述
我有一个名为 grdLOB 的 Janus GridEx 控件,它可以有多行。每行都有一个复选框和 3 个附加列。如果未选中某行(GL)上的复选框,我需要遍历网格并取消选中其他行中的复选框。
这是我的代码,但显然它不起作用......
Private Sub grdLOB_CellValueChanged(ByVal sender As Object, ByVal e as Janus.Windows.GridEX.ColumnActionEventArgs) Handles grdLOB.CellValueChanged
If e.Column.Key = cSelector Then
Dim grd As Janus.Windows.GridEX.GridEX = CType(sender, GridEX)
Dim row As GridEXRow = grd.GetRow(grd.Row)
Select Case row.Cells(1).Value.ToString().ToUpper()
Case "GL"
'If GL is checked, do nothing to the other rows.
'If GL is unchecked, uncheck all the other rows.
If CBool(row.Cells(0).Value) = False Then
For Each gr As GridEXRow In grdLOB.GetRows()
gr.BeginEdit()
gr.Cells(0).Value = False
gr.EndEdit()
Next
End If
Case Else
'If a row other than GL is unchecked, do nothing to the other rows.
'If a row other than GL is checked, then check the GL row.
If CBool(row.Cells(0).Value) = True Then
For Each gr As GridEXRow In grdLOB.GetRows()
If gr.Cells(1).Value = "GL" Then
gr.BeginEdit()
gr.Cells(0).Value = True
gr.EndEdit()
End If
Next
End If
End Select
End If
End Sub
如何在 GridEx 中动态选中\取消选中复选框?
解决方案
弄清楚了。这是更改后的有效 Select Case 代码:
Select Case row.Cells(1).Value.ToString().ToUpper()
Case "GL"
'If GL is checked, do nothing to the other rows.
'If GL is unchecked, uncheck all the other rows.
If CBool(row.Cells(0).Value) = False Then
For i As Integer = 0 To grdLOB.RowCount - 1
Dim gr As GridEXRow = grdLOB.GetRow(i)
gr.IsChecked = False
Next
End If
Case Else
'If a row other than GL is unchecked, do nothing to the other rows.
'If a row other than GL is checked, then check the GL row.
If CBool(row.Cells(0).Value) = True Then
For i As Integer = 0 To grdLOB.RowCount - 1
Dim gr As GridEXRow = grdLOB.GetRow(i)
If gr.Cells(1).Value = "GL" Then
gr.IsChecked = True
End If
Next
End If
End Select
推荐阅读
- javascript - 如何使用 vuejs 计算属性评估文本区域的最大长度?
- sql - 使用 oracle 的一个案例语句中的多个条件
- flutter - 如何在 Dart 中按 id 过滤?不搜索栏
- php - 如何修复“SQLSTATE[HY000] [14] 无法打开数据库文件”?
- java - JMeter:是否有命令或 API 来检查 JMeter 中从机的连接?
- stata - 在 Stata 中处理三维面板数据
- reactjs - 打字稿错误:类型中缺少属性“类”
- r - 将 R 中的热图导出为 EMF
- spring - 为什么 Spring boot 2.4.3 有与 entityManagerFactory bean 相关的迁移问题
- typo3 - Typo3 后端 HTML 元素 - 格式值错误