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

4.402.0.51 GGC Rebinding

Thread ID:

Created:

Updated:

Platform:

Replies:

54942 Jan 19,2007 07:55 PM UTC Jan 19,2007 09:20 PM UTC Windows Forms 3
loading
Tags: GridControl
Ivan Gamanyuk
Asked On January 19, 2007 07:55 PM UTC

First of all this is 2nd time I'm posting my question today - the previous message is gone

After upgrading to 4.402.0.51 I can no longer rebind datasets to the GGC:

1. When a DataSet binded to the GGC for the first time - everything seem to work/look fine.
2. When I bind another dataset with a different number of rows - the GGC displays the same amount of rows, that was in the first dataset.

If before setting the DataSource to a new DataSet I do DataSource=null - eveything works fine.

What would be a proper way of rebinding dataset to GGC 4.402.0.51?

Thank you


Administrator [Syncfusion]
Replied On January 19, 2007 08:16 PM UTC

Hi Ivan,

The GridGroupingRebind browser sample demonstrates the switching of datasources at runtime and how to reset the GridGroupingControl to its original empty state. The sample assigns different datasources (retrieved from the NorthWind MS Access database using OleDb) with different number of levels at runtime.The sample also demonstrates how to show additional nested tables in the GroupDropArea. Here is the code to change the dataset of the GridGroupingControl.

private void BindData(DataSet ds)
{
this.gridGroupingControl1.SuspendLayout();
this.gridGroupingControl1.DataSource = ds != null ? ds.Tables[0] : null;

// 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();

// Show group area
this.gridGroupingControl1.ShowGroupDropArea = true;

// Additional table descriptors currently have to be added manually
//We plan to provide a TableDescriptor.ShowInGroupDropArea property later to make this easier
AddGroupDropAreas(this.gridGroupingControl1.Table);

// Make changes to schema. See above notes how to reset changes
SetReadOnly(this.gridGroupingControl1.Table);
this.gridGroupingControl1.ResumeLayout(true);
}

Here is a sample path.
[install drive]\Syncfusion\Essential Studio\4.4.0.49\Windows\Grid.Grouping.Windows\Samples\FeatureSamples\GridGroupingRebind

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On January 19, 2007 08:38 PM UTC

Thank you for the response.
What do I need to do to preserve
Column and Relation discriptors, which are defined in designed mode?

Thank you

Administrator [Syncfusion]
Replied On January 19, 2007 09:20 PM UTC

Hi Ivan,

Before changing the underlying datasource, you can get the GridVisibleColumnDescriptorCollection and RelationDescriptorCollection from the table descriptor.And then set the TableDescriptor.VisibleColumns and TableDeriptor.Relations after changing the datasource. Here is a code snippet to do this.

GridVisibleColumnDescriptorCollection columns = this.gridGroupingControl1.TableDescriptor.VisibleColumns;
GridVisibleColumnDescriptor[] arr = new GridVisibleColumnDescriptor[columns.Count] ;
columns.CopyTo(arr,0) ;

GridRelationDescriptorCollection relations = this.gridGroupingControl1.TableDescriptor.Relations;
GridRelationDescriptor[] rrr = new GridRelationDescriptor[relations.Count];
relations.CopyTo(rrr,0);

//Your Rebind code here....

columns.AddRange(arr) ;
relations.AddRange(rrr);

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.

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

;