Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1650
Change the caption of a groupby row
posted

Along these same lines...

How can I control the header.caption of a groupby row?

I was able to remove the column header that was grouped, but now I am left with ': CATEGORYNMAME (N items).

I want to be able to write my own captions, or at least get ride of the ':' and the number of items in the perenthaces.

 

 

Parents
No Data
Reply
  • 1650
    Verified Answer
    posted

    This gets what I was looking for:

     

    Private Sub grdFilters_InitializeGroupByRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeGroupByRowEventArgs) Handles grdFilters.InitializeGroupByRow
          If e.Row.Rows.VisibleRowCount > 0 Then

             Dim firstChildRow As Infragistics.Win.UltraWinGrid.UltraGridRow = e.Row
             Dim enumeratorForChildRows As Infragistics.Win.UltraWinGrid.RowEnumerator = Nothing

             'We can have multiple group by layers. Iterate to the first
             'non group-by row and read the data then
             While firstChildRow.IsGroupByRow
                enumeratorForChildRows = DirectCast(firstChildRow, Infragistics.Win.UltraWinGrid.UltraGridGroupByRow).Rows.GetEnumerator()
                enumeratorForChildRows.MoveNext()
                firstChildRow = enumeratorForChildRows.Current
             End While

             If enumeratorForChildRows IsNot Nothing Then
                'Find first usable row with data
                While firstChildRow.Hidden OrElse Not firstChildRow.IsDataRow OrElse firstChildRow.IsFilteredOut
                    If Not enumeratorForChildRows.MoveNext() Then
                            'No usable rows with data found (should be pretty uncommon situation)
                            'just return
                        Exit Sub
                    End If
                   
                    firstChildRow = enumeratorForChildRows.Current
                End While
               
                e.Row.Description = CStr(iif(strings.Len(firstChildRow.Cells(e.Row.Column).Text) = 0, _
                                               "Misc.", firstChildRow.Cells(e.Row.Column).Text))
             End If
          End If
       End Sub

Children