Igor/10Tec
2014-04-15T14:49:23Z
The nature of the problem is the same. GroupRowSumManager attaches an event handler to the target grid's AfterContentsGrouped event, and this event is raised for the empty column set while the FillWithData method repopulates the grid.

My first intention was to implement a Detach method in GroupRowSumManager so you could use the same technique as earlier, i.e. detach the grid before the FillWithData call and attach it again after the grid has been populated with new data. But after some thinking, I can suggest a much better way. We can check whether the column set is empty directly in the AfterContentsGrouped event handler and do nothing if it is the case. This will allow you to write your code as you like without adjusting it to the peculiarities of GroupRowSumManager.

Thus, to solve the problem once for all cases, the beginning of the event handler should look like this (add the highlighted row):

Private Sub Grid_AfterContentsGrouped(ByVal sender As Object, ByVal e As System.EventArgs)
   If fGrid.Rows.Count = 0 Then Return
   If fGrid.Cols.Count = 0 Then Return
kadara
2014-04-15T20:13:15Z
Thanks.
Do you have any kind of suggestions related to post #19 ?
Igor/10Tec
2014-04-16T14:41:30Z
Originally Posted by: kadara 

I do not want to display the subtotals for the 3-5 columns, only for the last column (column 5).
I would like to do the following things:
- display the columns 3, 4 and 5 in HH:MM:SS format (using the iGCellDynamicContents event handler)
- display the total for the colummn 5 (using the SubTotalManager)



Sorry if I missed that. The solution is simple:

Private Sub Grid_CellDynamicContents(ByVal sender As Object, ByVal e As iGCellDynamicContentsEventArgs)

	Select Case e.ColIndex
	Case 3, 4, 5

		If Not String.IsNullOrEmpty(e.Text) Then

			Dim iSpan As TimeSpan = TimeSpan.FromSeconds(e.Text)
			e.Text = iSpan.Hours.ToString.PadLeft(2, "0"c) & ":" & iSpan.Minutes.ToString.PadLeft(2, "0"c) & ":" & iSpan.Seconds.ToString.PadLeft(2, "0"c)

		End If

	End Select

End Sub

Sure, I imply that you define totals only for the column 5:

iGSubtotalManager.ShowSubtotals(fGrid, New Integer() {5})