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.

GGC ResizeToFit after setting a datasource 4.402.0.51

Thread ID:

Created:

Updated:

Platform:

Replies:

55187 Jan 24,2007 02:49 PM Jan 24,2007 04:36 PM Windows Forms 2
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On January 24, 2007 02:49 PM

Hi,
I'm having an issue while calling ResizeToFit method of the GGC (4.402.0.51):
this.oGrid.TableControl.Model.ColWidths.ResizeToFit(GridRangeInfo.Auto(-1, -1), GridResizeToFitOptions.IncludeHeaders);

If the Datasource changes from null to a populated table, the everything works fine, if the GGC is bound to a table for the second time the following exception is thrown:
catched at Syncfusion.Grouping.RuntimeElementsInTableCollection.get_Count() in :line 0
System.NullReferenceException: Object reference not set to an instance of an object.
at Syncfusion.Grouping.Table.EnsureSortFields()
at Syncfusion.Grouping.Table.OnCategorizingRecords(TableEventArgs e)
at Syncfusion.Grouping.Table.CategorizeElements()
at Syncfusion.Grouping.Table.OnEnsureInitialized(Object sender)
at Syncfusion.Grouping.Element.EnsureInitialized(Object sender, Boolean notifyParent)
at Syncfusion.Grouping.Table.BaseEnsureInitialized(Object sender, Boolean notifyParent)
at Syncfusion.Grouping.Table.EnsureInitialized(Object sender, Boolean notifyParent)
at Syncfusion.Grouping.Record.AdjustRecordRowCount()
at Syncfusion.Grouping.Record.GetVisibleCount()
at Syncfusion.Grouping.Record.GetCounter()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterEntry.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterBranch.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetCounterTotal()
at Syncfusion.Grouping.Internals.ElementTreeTable.get_VisibleCount()
at Syncfusion.Grouping.DetailsSection.GetVisibleCount()
at Syncfusion.Windows.Forms.Grid.Grouping.GridGroupExtend.OnInitializeVisibleCounters(Group owner, GridGroupOptionsStyleInfo go)
at Syncfusion.Windows.Forms.Grid.Grouping.GridChildTable.OnInitializeVisibleCounters()
at Syncfusion.Grouping.Group.InitVisibleCounters()
at Syncfusion.Grouping.Group.GetVisibleCount()
at Syncfusion.Grouping.Element.GetCounter()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounterEntry.GetCounterTotal()
at Syncfusion.Collections.BinaryTree.TreeTableWithCounter.GetCounterTotal()
at Syncfusion.Grouping.Internals.ElementTreeTable.get_VisibleCount()
at Syncfusion.Grouping.Table.GetVisibleCount()
at Syncfusion.Grouping.Element.GetCounter()
at Syncfusion.Grouping.RuntimeElementsInTableCollection.get_Count()
A first chance exception of type 'System.NullReferenceException' occurred in Syncfusion.Grid.Grouping.Windows.dll

Please advise.
Thank you

Administrator [Syncfusion]
Replied On January 24, 2007 02:56 PM

A little remark:
The column descriptors have Filter set to true.

In general the filter row handling has become unacceptable since 4.1 - it's even impossible to enable filter for a column desriptor in the designer!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Administrator [Syncfusion]
Replied On January 24, 2007 04:36 PM

Hi Ivan,

Before re-bind the datasource, you need to reset the main table descriptor by calling ResetTableDescriptor method and then reset the nested relations by calling TableDescriptor.Relations.Reset method. And also you need to reset the current record. Please try the suggestion and let me know if this helps.

[C#]
// This is by design and allows users to swap the datasource at runtime without having to worry that manual changes to the schema are lost
// In order to Reset the main table descriptor and also the nested relations use the following two lines

this.gridGroupingControl1.ResetTableDescriptor();
this.gridGroupingControl1.TableDescriptor.Relations.Reset();
this.gridGroupingControl1.Table.CurrentRecord = null;

//your re-bind code here

Best Regards,
Haneef

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.

;