Hi, I'm dealing with a format issue in a CountFunction. Basically, we want to display the count of the rows as a result of a grouping. I do this in the Grouping and Grouped event as shown below:
I'm sorry if the format is somewhat whacked. The result of the code is something like this, (in the group header)
Column A 5 5 5
Column B 2 2 2
Column C 3 3 3
When the desired format should be
Column A 5
Column B 2
Column C 3
What exactly is my code doing wrong? Is this by design?
Thanks,
Gio
private
void
gridView_Grouping(
object
sender, GridViewGroupingEventArgs e)
{
var descriptor = e.GroupDescriptor
as
ColumnGroupDescriptor;
if
(descriptor !=
null
)
{
var functions = descriptor.Column.AggregateFunctions;
if
(functions.Count == 0)
{
functions.Add(
new
CountFunction());
}
}
}
private
void
gridView_Grouped(
object
sender, GridViewGroupedEventArgs e)
{
if
(e.Action == GroupingEventAction.Remove)
{
((ColumnGroupDescriptor)(e.GroupDescriptor)).Column.AggregateFunctions.Clear();
}
}
I'm sorry if the format is somewhat whacked. The result of the code is something like this, (in the group header)
Column A 5 5 5
Column B 2 2 2
Column C 3 3 3
When the desired format should be
Column A 5
Column B 2
Column C 3
What exactly is my code doing wrong? Is this by design?
Thanks,
Gio