【问题标题】:ultragrid filtered rows selection超网格过滤行选择
【发布时间】:2012-12-06 23:36:26
【问题描述】:

我正在使用 Infragistics Ultragrid 2008,我有一个按钮用于选中和取消选中网格中的选定列。

即使当我单击按钮时也激活了行过滤器,它也会检查隐藏行选择的列。

我只想为可见的行将选定列设置为 true。请帮我提供 vb.net 2008 的代码

这是我现在使用的代码

    Me.lbltotal.Text = "0.00"

    Dim i As Integer = 0

    Dim nDx As Boolean = False
    If Me.btnSelectAll.Text = "Select All" Then
        nDx = True
    Else
        nDx = False
    End If

    While i < Me.UninvoicedMemosDataGrid.Rows.Count

        Me.UninvoicedMemosDataGrid.Rows(i).Cells(9).Value = nDx
        Me.UninvoicedMemosDataGrid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode)
        Me.UninvoicedMemosDataGrid.Update()
        i += 1
    End While

    If Me.btnSelectAll.Text = "Select All" Then
        Me.btnSelectAll.Text = "Deselect All"
    Else
        Me.btnSelectAll.Text = "Select All"
    End If


    Dim r As Integer
    Dim sum As Single = 0.0
    For r = 0 To UninvoicedMemosDataGrid.Rows.Count - 1
       If UninvoicedMemosDataGrid.Rows(r).Cells(9).Value() = True Then sum += UninvoicedMemosDataGrid.Rows(r).Cells(8).Value()

        Me.lbltotal.Text = sum
    Next
    Dim n As Integer
    n = Me.lbltotal.Text
    lbltotal.Text = n.ToString("###,##0.00")

【问题讨论】:

  • 您的代码是否遇到任何特定错误或问题?除了通用的“请帮助我编写代码”之外,如果您知道问题可能是什么,它将帮助我们集中注意力。

标签: .net infragistics


【解决方案1】:

如果您的意图是仅将计算应用于当前列过滤器未隐藏的行,那么您应该以这种方式更改循环

For each row in Me.UninvoicedMemosDataGrid.Rows.GetFilteredInNonGroupByRows()
    row.Cells(9).Value = nDx
Next
' Only one cell could be in edit mode, so this should go outside the loop '
row.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.ExitEditMode)
' same for data updating....'
Me.UninvoicedMemosDataGrid.Update()

还有这个 (根据您上面的代码,每行都应该始终为真或假)

For each row in UninvoicedMemosDataGrid.Rows.GetFilteredInNonGroupByRows()
   If row.Cells(9).Value() = True Then 
       sum += row.Cells(8).Value
   End if
Next
Me.lbltotal.Text = sum

但是,我不太确定您的意图。因此,请告诉我这是您要找的内容,还是我误解了您的意图。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-06-09
    • 2015-11-12
    • 2013-04-17
    • 1970-01-01
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多