I have a wingrid that I am grouping by a date column. I want the group by rows to show the date in short format (mm/dd/yyyy or "d"). But no matter what I do, it always displays mm/dd/yyyy 12:00:00 AM. I tried setting this at design time and at runtime. Maybe I am changing the wrong setting: Here is what I tried today:
gridDate.DisplayLayout.Bands(0).SortedColumns("EventTimestamp").Format = "d"
gridDate.DisplayLayout.Bands(0).SortedColumns.Add("EventTimestamp", True, True)
gridDate.DisplayLayout.Bands(0).SortedColumns("EventTimestamp").Format = "mm/dd/yyyy"
Hi hcrpm,
I'm Pretty sure that you have to go to the column and set the Format:
gridDate.DisplayLayout.Bands(0).Columns("EventTimestamp").Format = "MM/dd/yyyy" See here that i use capital M's, cos lower m's are referring to minutes.
Nassos
Sorry, I should have mentioned that the actual column format was already set properly (and it displays properly when it is not grouped). I usually forget to use the captial M's, but in this case I didn't forget. So the column format is set and the sorted column format is set and I still get the full date / time which I don't want. I tried both "d" and "MM/dd/yyyy" and I tried setting the format at design time and runtime. I am using VS 2005 and Netadvantage 2007 vol. 3.
May have found a solution. Setting the GroupByMode of the sorted column to Text seems to work:
gridDate.DisplayLayout.Bands(0).SortedColumns("EventTimestamp").GroupByMode = GroupByMode.Text
In my case I don't think that works because I have multiple group by rows and I think the description mask applies to the entire band. The GroupByMode = GroupByMode.Text method seems to be working fine.
I think what you are looking for is the GroupByRowDescriptionMask property. This determines the text that is displayed in the GroupByRow. I am pretty sure that the Format of the column is not used for the GroupByRow.