We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Retrieving GridSummaryColumnDescriptor column in QueryCellStyleInfo event

Thread ID:

Created:

Updated:

Platform:

Replies:

48716 Sep 3,2006 05:42 PM UTC Sep 4,2006 08:52 AM UTC Windows Forms 3
loading
Tags: Grouping
jamesb
Asked On September 3, 2006 05:42 PM UTC

if I have previous defined a GridSummaryColumnDescriptor and added it to an summary row

GridSummaryColumnDescriptor sd1 = new GridSummaryColumnDescriptor();
sd1.Name = "QuantityTotal1";
sd1.DataMember = "Quantity1";


GridSummaryColumnDescriptor sd2 = new GridSummaryColumnDescriptor();
sd2.Name = "QuantityTotal2";
sd2.DataMember = "Quantity2";

this.gridGroupingControl1.TableDescriptor.SummaryRows.Add(new GridSummaryRowDescriptor("Row 1", "Total", new GridSummaryColumnDescriptor[] {sd1,sd1}));


How do I retrieve specific summary column in the
QueryCellStyleInfo event from the GridColumnDescriptor column as described below?

// you can get the column as follows:
GridColumnDescriptor column = e.TableCellIdentity.Table.GetColumnDescriptorAt(e.Style.TableCellIdentity.RowIndex+1, e.Style.TableCellIdentity.ColIndex);


// Using that column above, how can i and identify the summary that should be displayed in this cell.


Administrator [Syncfusion]
Replied On September 4, 2006 05:22 AM UTC

Hi James,

You can use the GetSummaryColumnAtCol method to get the GridSummaryColumnDescriptor in a grid. The GridSummaryColumnDescriptor.DisplayColumn property lets you specify under which column the summary should be displayed in the grid. GridSummaryColumnDescriptor elements that are added to the same row descriptor will be shown in the same row. Below is a code snippet

GridSummaryColumnDescriptor sd = e.TableCellIdentity.Table.TableDescriptor.SummaryRows["Row 1"].GetSummaryColumnAtCol(e.Style.TableCellIdentity.ColIndex);

Let me know if this helps.
Best Regards,
Haneef


jamesb
Replied On September 4, 2006 08:06 AM UTC

This is still not working ro me. I do get a reference to the

GridSummaryColumnDescriptor col1 = new GridSummaryColumnDescriptor("sumCol1", SummaryType.Int32Aggregate, "[8/7/2006]", "{Sum:#}");
GridSummaryColumnDescriptor col2 = new GridSummaryColumnDescriptor("sumCol2", SummaryType.Int32Aggregate, "[8/14/2006]", "{Sum:#}");
GridSummaryColumnDescriptor col3 = new GridSummaryColumnDescriptor("sumCol3", SummaryType.Int32Aggregate, "[8/21/2006]", "{Sum:#}");
GridSummaryColumnDescriptor col4 = new GridSummaryColumnDescriptor("sumCol4", SummaryType.Int32Aggregate, "[8/28/2006]", "{Sum:#}");

GridSummaryRowDescriptor row = new GridSummaryRowDescriptor("Caption", "CaptionTitle", new GridSummaryColumnDescriptor[] { col1, col2, col3, col4 });
row.Visible = false;
this.gridGroupingControl.TableDescriptor.SummaryRows.Add(row);


In the QueryCellStyleInfo event, I have something like this...

if ( (e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionCell || e.TableCellIdentity.TableCellType == GridTableCellType.GroupCaptionSummaryCell))
{
Group group = e.TableCellIdentity.DisplayElement.ParentGroup;
GridTable table = e.TableCellIdentity.DisplayElement.ParentTable as GridTable;

GridSummaryRowDescriptor summaryRowDescriptor = table.TableDescriptor.SummaryRows["Caption"];
GridSummaryColumnDescriptor sumCol1 = summaryRowDescriptor.SummaryColumns[colIndex - 5];

if (sumCol1 != null)
{
SummaryDescriptor sd1 = sumCol1.SummaryDescriptor;
if (sd1 != null)
{

ISummary groupSummary = this.gridGroupingControl.Table.TopLevelGroup.GetSummary(colIndex - 5);
Int32AggregateSummary int32Summary = (Int32AggregateSummary)groupSummary;
int sum = int32Summary.Sum;
int max = int32Summary.Maximum;
int cnt = int32Summary.Count;

}
}
}

However, sum, max, and cnt arte always zero. What am I doing wrong?

jamesb
Replied On September 4, 2006 08:52 AM UTC

I fix it... change date "[8/21/2006]" to "8/21/2006"

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;