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.

Change of Format getting issue

Thread ID:

Created:

Updated:

Platform:

Replies:

75049 Jul 10,2008 05:38 AM Jul 16,2008 03:29 AM Windows Forms 7
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On July 10, 2008 05:38 AM

Unable to cast object of type 'Syncfusion.Grouping.BooleanAggregateSummary' to type 'Syncfusion.Grouping.CountSummary'.

Shall you give clarification on this exception


Sri Rajan [Syncfusion]
Replied On July 10, 2008 07:32 AM

Hi Manjesh,

Thank you for your interest in Syncfusion products.

It is hard to trace out the problem without a working sample which reproduces this issue. Is it possible for you to upload a minimal sample which reproduces this issue?. That will help us to analyze this issue further.

Best Regards,
Srirajan.


Administrator [Syncfusion]
Replied On July 11, 2008 10:08 AM

Hi,
I am very thankful to you for your quick response to my issue.

I have a two level heirarchical table which includes two tables(eg Table A and B(child)),

There I take any field(column) of table A and added summarycolumn for that.After that if i change the format of this parent table it works fine.

But in the case of inner table B,when i proceed with the same senario that i have done with parent table A,it fails to produce an output and through an exception.

Please confirm, is it a missed functionality with syncfusion 4.4?





cast_Exception_2fcb0ac9.zip

Sri Rajan [Syncfusion]
Replied On July 14, 2008 05:13 AM

Hi Manjesh,

Thank you for your continued interest in Syncfusion products.

Please refer the below code which shows you how to change Summary Column format of Parent and Child Tables.

DataTable parentTable = ParentTable();
DataTable childTable = ChildTable();
DataSet dSet = new DataSet();
dSet.Tables.AddRange(new DataTable[] { parentTable, childTable});
DataColumn parentColumn = parentTable.Columns["PID"];
DataColumn childColumn = childTable.Columns["PID"];
dSet.Relations.Add("ParentToChild", parentColumn, childColumn);
this.gridGroupingControl1.DataSource = parentTable;
this.gridGroupingControl1.Engine.BindToCurrencyManager = false; // don't attach this one to CurrencyManager.

GridSummaryColumnDescriptor scd1 = new GridSummaryColumnDescriptor("Sum", SummaryType.Int32Aggregate, "ParentValue", "{Sum:#}");
GridSummaryRowDescriptor srd1 = new GridSummaryRowDescriptor("Sum", "Total", scd1);
srd1.Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Right;
srd1.Appearance.AnyCell.BackColor = SystemColors.Info;

GridSummaryColumnDescriptor scd2 = new GridSummaryColumnDescriptor("Sum", SummaryType.Int32Aggregate, "ChildValue", "{Sum:#}");
GridSummaryRowDescriptor srd2 = new GridSummaryRowDescriptor("Sum", "Total", scd2);
srd2.Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Right;
srd2.Appearance.AnyCell.BackColor = SystemColors.Info;

this.gridGroupingControl1.GetTableDescriptor("ParentTable").SummaryRows.Add(srd1); this.gridGroupingControl1.GetTableDescriptor("ChildTable").SummaryRows.Add(srd2);

//Change the format here.
scd1.Format = "{Sum:##.0000}";
scd2.Format = "{Sum:##.00}";


Here is the minimal sample which implements this task.
http://websamples.syncfusion.com/samples/grid.windows/F75049/main.htm

Please let me know if this helps.

Best Regards,
Srirajan.


Administrator [Syncfusion]
Replied On July 14, 2008 10:05 AM

Hi Srirajan,

Thankyou very much for the quick response.

I just went through the sample program for setting the summary rows. For m case the application works fine while adding the summary rows; but i get an invalid cast exception while changing the summary type of an already existing summary column descriptor. I'm pasting the psuedo code below,

GridSummaryColumnDescriptor sd = this.m_tableDescriptor.SummaryRows[0].SummaryColumns["OrderID"]

sd.SummaryType = SummaryType.BooleanAggregate;


Please let me know how to edit the summary type of an existing summary column descriptor.

Thanks in advance.




>Hi Manjesh,

Thank you for your continued interest in Syncfusion products.

Please refer the below code which shows you how to change Summary Column format of Parent and Child Tables.

DataTable parentTable = ParentTable();
DataTable childTable = ChildTable();
DataSet dSet = new DataSet();
dSet.Tables.AddRange(new DataTable[] { parentTable, childTable});
DataColumn parentColumn = parentTable.Columns["PID"];
DataColumn childColumn = childTable.Columns["PID"];
dSet.Relations.Add("ParentToChild", parentColumn, childColumn);
this.gridGroupingControl1.DataSource = parentTable;
this.gridGroupingControl1.Engine.BindToCurrencyManager = false; // don't attach this one to CurrencyManager.

GridSummaryColumnDescriptor scd1 = new GridSummaryColumnDescriptor("Sum", SummaryType.Int32Aggregate, "ParentValue", "{Sum:#}");
GridSummaryRowDescriptor srd1 = new GridSummaryRowDescriptor("Sum", "Total", scd1);
srd1.Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Right;
srd1.Appearance.AnyCell.BackColor = SystemColors.Info;

GridSummaryColumnDescriptor scd2 = new GridSummaryColumnDescriptor("Sum", SummaryType.Int32Aggregate, "ChildValue", "{Sum:#}");
GridSummaryRowDescriptor srd2 = new GridSummaryRowDescriptor("Sum", "Total", scd2);
srd2.Appearance.AnyCell.HorizontalAlignment = GridHorizontalAlignment.Right;
srd2.Appearance.AnyCell.BackColor = SystemColors.Info;

this.gridGroupingControl1.GetTableDescriptor("ParentTable").SummaryRows.Add(srd1); this.gridGroupingControl1.GetTableDescriptor("ChildTable").SummaryRows.Add(srd2);

//Change the format here.
scd1.Format = "{Sum:##.0000}";
scd2.Format = "{Sum:##.00}";


Here is the minimal sample which implements this task.
http://websamples.syncfusion.com/samples/grid.windows/F75049/main.htm

Please let me know if this helps.

Best Regards,
Srirajan.




Sri Rajan [Syncfusion]
Replied On July 15, 2008 06:40 AM

Hi Manjesh,

Thank you for your interest in syncfusion products.

Here is the code to change the summary type.

GridSummaryColumnDescriptor sd = this.gridGroupingControl1.GetTableDescriptor("ParentTable").SummaryRows[0].SummaryColumns[0];
sd.SummaryType = SummaryType.DoubleAggregate;


Please let me know if this helps.

Best Regards,
Srirajan.



Administrator [Syncfusion]
Replied On July 15, 2008 09:27 AM

Hi SreeRajan,
Thanks a lot.Please check ur code and pleae let me know why this is not working in the case of button click




GGC_MasterDetail_Summary_1c5a96e3.zip

Sri Rajan [Syncfusion]
Replied On July 16, 2008 03:29 AM

Hi Manjesh,

Thank your continued interest in Syncfusion products.

It is not possible to convert SummaryType from SummaryType.Count to SummaryType.BooleanAggregate. You can change the summary column type using following technique. Please refer the below code for more details.

private void button1_Click(object sender, EventArgs e)
{
GridSummaryColumnDescriptor sd = this.gridGroupingControl1.GetTableDescriptor("ChildTable").SummaryRows[0].SummaryColumns[0];
sd.SummaryType = SummaryType.Int32Aggregate;
this.gridGroupingControl1.GetTableDescriptor("ChildTable").SummaryRows[0].SummaryColumns.RemoveAt(0);
this.gridGroupingControl1.GetTableDescriptor("ChildTable").SummaryRows[0].SummaryColumns.Add(sd);
this.gridGroupingControl1.GetTableDescriptor("ChildTable").SummaryRows[0].ResetDisplayColumns();
this.gridGroupingControl1.Refresh();
}


Please let me know if this helps.

Best Regards,
Srirajan.


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.

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.

;