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.

4.1 GGC Rebind

Thread ID:

Created:

Updated:

Platform:

Replies:

41112 Feb 22,2006 12:31 PM Feb 22,2006 03:46 PM Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On February 22, 2006 12:31 PM

Hi, I''m using GGC with TableDescriptors defined through a designer. The datasource of the GGC changes during runtime - it could be a valid DataSet or null. In second case the grid throws an exception: ************************************ Warning: Possible incorrect RelationDescriptor.ChildTableName for Relation RELATION_NAME. Engine.SourceListSet[SOME_RELATION] returned null. Did you forget to call Engine.SourceListSet.Add(new SourceListSetEntry(SOME_RELATION, list) or did you specify a wrong ChildTableName? Valid ChildTableName entries are: System.InvalidOperationException: Possible incorrect RelationDescriptor.ChildTableName for Relation DetailPackage. Engine.SourceListSet[Package] returned null. Did you forget to call Engine.SourceListSet.Add(new SourceListSetEntry(Package, list) or did you specify a wrong ChildTableName? Valid ChildTableName entries are: at Syncfusion.Grouping.Table.EnsureSourceList() at Syncfusion.Grouping.Table.EnsureInitialized(Object sender, Boolean notifyParent) at Syncfusion.Grouping.Element.EnsureInitialized(Object sender) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.UpdateColumnWidths(Boolean force) at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.UpdateColumnWidths() at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.VisibleColumns_TotalWidthRequest(Object sender, CancelEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptorCollection.OnTotalWidthRequest(CancelEventArgs e) at Syncfusion.Windows.Forms.Grid.Grouping.GridVisibleColumnDescriptorCollection.get_TotalWidth() at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.GetHorizontalScrollWidth(Boolean isNested) at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.GetHorizontalScrollWidth(Boolean isNested) at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.GetHorizontalScrollWidth(Boolean isNested) at Syncfusion.Windows.Forms.Grid.Grouping.GridTable.GetHorizontalScrollWidth() at Syncfusion.Windows.Forms.Grid.Grouping.GridTableModel.OnQueryColWidth(GridRowColSizeEventArgs e) at Syncfusion.Windows.Forms.Grid.GridModel.RaiseQueryColWidth(GridRowColSizeEventArgs e) at Syncfusion.Windows.Forms.Grid.GridModelColWidthsIndexer.OnQuerySize(GridRowColSizeEventArgs e) at Syncfusion.Windows.Forms.Grid.GridModelRowColSizeIndexer.GetSize(Int32 index) at Syncfusion.Windows.Forms.Grid.GridModelRowColSizeIndexer.get_Item(Int32 index) at Syncfusion.Windows.Forms.Grid.GridControlBase.GetColWidth(Int32 colIndex) at Syncfusion.Windows.Forms.Grid.GridViewLayout.Initialize() at Syncfusion.Windows.Forms.Grid.GridViewLayout.DemandInitialize() at Syncfusion.Windows.Forms.Grid.GridViewLayout.RectangleToClientRowCol(Rectangle rect, Int32& topRow, Int32& leftCol, Int32& bottomRow, Int32& rightCol, GridCellSizeKind sizeKind) at Syncfusion.Windows.Forms.Grid.GridPaint.DrawGrid(Graphics g, Boolean shouldClip, Rectangle rectClip) at Syncfusion.Windows.Forms.Grid.GridControlBase.OnPaint(PaintEventArgs pe) catched at Syncfusion.Windows.Forms.Grid.GridControlBase.OnPaint(PaintEventArgs pe) in :line 0 What would be a correct approach to rebind data during the runtime? Thank you

Administrator [Syncfusion]
Replied On February 22, 2006 12:48 PM

Let me elaborate a little further: If I call this.gridGroupingControl1.ResetTableDescriptor(); this.gridGroupingControl1.TableDescriptor.Relations.Reset(); I obviously loose all descriptors, create at design time and do not want to recreate them manually everytime the datasource changes Thank you

Administrator [Syncfusion]
Replied On February 22, 2006 01:36 PM

The solution I found is the following: 1. In the costructor of the host form save GridRelationDescriptorCollection: col=(GridRelationDescriptorCollection)this.GGC.TableDescriptor.Relations.Clone(); 2. Set the DataSource in the following manner: this.GGC.SuspendLayout(); this.GGC.TableDescriptor.Relations.Reset(); if(ds!=null&&ds.Tables.Count>0&&ds.Tables[0].Rows.Count>0) { this.GGC.DataSource=ds.Tables[0]; this.GGC.TableDescriptor.Relations=col; } else { this.GGC.DataSource=null; } this.GGC.ResumeLayout(true); Is there more efficient ("right") way of doing it? Thank you

Administrator [Syncfusion]
Replied On February 22, 2006 02:33 PM

Hi Ivan, you could save the whole Engine with all its settings and nested relations using this code: GridEngine savedEngine = new GridEngine(); savedEngine.InitializeFrom(gridgroupingControl.Engine); Then you could reset the relations in your control if the datasource is null. If it is not null you can restore the engine settings with gridgroupingControl.Engine.InitializeFrom(savedEngine); The InitializeFrom logic can be used with any descriptors. The way you could also just save a TableDescriptor with nested relations and restore it back at a later time. Stefan

Administrator [Syncfusion]
Replied On February 22, 2006 03:46 PM

This works! Thank you for the detail explanation.

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.

;