Hi.
I have a datasource that contains a DateTime column. In the grid this column has its Style set to 'DateTime' but its GroupByMode property set to 'Date'. When I group by this column the values are grouped by date but the time is still shown in the group by rows row description.
Is this the expected behavior?
In the screen shots below it makes it look like the 2nd row has a time of 13:45 when its actually 14:45.
I've been using your suggested code and its is working fine.
Thanks for looking into to it.
Hi,
We looked into this and the way it works is that the Value of the GroupByRow comes from the first row in the group. The text in the GroupByRow for the value is formatted based on the formatting of the grid column, so that the value in the GroupByRow looks like same as it does in the grid cells for that column.
Now, in theory, we could set the time to midnight on the GroupByRow's Value, but it would still show the time.
There's no way we can format the value differently than the cells in the column, because there's no way for us to know which format to use: the column format of the format that is implied by the GroupByMode.
So after further review, it appears that this is not a bug, and the best thing to do is use the code I provided here so that you have total control over the GroupByRow text.
If this is not acceptable to you, then the only alternative we could do, without breaking existing applications, would be to add a GroupByFormat to the column. This would act just like the Format property on the column, except that it would only affect the GroupByRow. But the default behavior would still be a little weird and you would have to set another property instead of handling an event, which doesn't really save you all that much.
Hello,
I will be happy to help you out with this issue.
I have created case # CAS-79231-MK8GTZ for you to better assist you with this issue going forward. To access the case, simply log into your IG account and click on My Support Activity.
Please let me know if you have further questions in this matter utilizing the case created.
I don't think this is the expected behavior. It seems like an oversight to me.
I'm going to forward this thread over to Infragistics Developer support and ask them to create a case for you and write this up as a bug for developer review.
In the mean time, it's very easy to work around it like so:
Private Sub UltraGrid1_InitializeGroupByRow(sender As System.Object, e As Infragistics.Win.UltraWinGrid.InitializeGroupByRowEventArgs) Handles UltraGrid1.InitializeGroupByRow Dim dateValue As DateTime = e.Row.Value Dim mask As String Dim childRowCount As Integer = e.Row.Rows.Count If childRowCount = 1 Then mask = "{0}: {1} ({2} item)" Else mask = "{0}: {1} ({2} items)" End If e.Row.Description = String.Format(mask, e.Row.Column.Header.Caption, dateValue.ToString("d"), childRowCount) End Sub