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

GridGroupingControl Exception

Thread ID:

Created:

Updated:

Platform:

Replies:

30431 Jun 17,2005 01:31 PM UTC Feb 22,2006 05:47 PM UTC Windows Forms 7
loading
Tags: GridControl
Mikaël Morvan
Asked On June 17, 2005 01:31 PM UTC

Hi, I use a gridGroupingControl with an ArrayList of ''CoolCompte'' as data source. I use two GridColumnDescriptor. The first one use "Numero" as MappingName. The second use "Libelle" as MappingName. I use two classes : ''CoolCompte'' and ''CoolCompteTiers''. The ''CoolCompte'' class have 2 string properties : "Numero" & "Libelle". The ''CoolCompteTiers'' inherit from ''CoolCompte'' and have a ''Collectif'' property. When i bind the grid with an array list of ''CoolCompte'', it works fine. When i rebind the grid with an array list of ''CoolCompteTiers'', it works fine. When i rebind the grid whith an array list of ''CoolCompte'', this exception occurs and my application freeze. System.Reflection.TargetInvocationException: L''accesseur de propriété ''Collectif'' sur l''objet ''SageCoala.Cool.Compta.CoolCompte'' a levé l''exception suivante :''L''objet ne correspond pas au type cible.'' ---> System.Reflection.TargetException: L''objet ne correspond pas au type cible. at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess) at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean verifyAccess) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component) --- Fin de la trace de la pile d''exception interne --- at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component) at Syncfusion.Grouping.FieldDescriptor._GetValue(Record record) catched at Syncfusion.Grouping.FieldDescriptor._GetValue(Record record) in :line 0 Why do the grid try to access to the ''Collectif'' property whereas there''s no GridColumnDescriptor with Collectif MappingName. Is there a work arround ? Regards, Mikaël

Administrator [Syncfusion]
Replied On June 17, 2005 03:44 PM UTC

Try calling TableDescriptor.Columns.LoadDefault after setting up the columns and DataSource. Here is a little sample. http://www.syncfusion.com/Support/user/uploads/GGC_ArrayList_d5553255.zip

Mikaël Morvan
Replied On June 17, 2005 04:27 PM UTC

The TableDescriptor.Columns.LoadDefault method modify the way the columns were ordered and do not fix the problem. Is there any other solution ?

Administrator [Syncfusion]
Replied On June 17, 2005 05:29 PM UTC

Does the sample throw teh exception for you? If so, what version are you using? I used 3.2.1.0. You can control the order in which the columns are displayed by populating grid.TableDescriptor.VisibleColumns in teh order you want to see teh columns after the call to LoadDefault.

Mikaël Morvan
Replied On June 20, 2005 10:39 AM UTC

I used 3.2.1.0. I attached a sample to show the problem ( This sample). Click Button 1 : It''s Ok Click Button 2 : It''s Ok Click Button 1 again : The exception occurs

Administrator [Syncfusion]
Replied On June 20, 2005 12:39 PM UTC

I can avoid the problem by adding these lines at the very top of your BindData routine.
if(this.ggc_grid.DataSource != null)
{
	this.ggc_grid.BeginUpdate();
	this.ggc_grid.DataSource = null;
	this.ggc_grid.Refresh();
	this.ggc_grid.EndUpdate(false);
}
I will send your sample onto the grid architect to see why the code does not work without nulling the datasource.

Mikaël Morvan
Replied On June 20, 2005 01:16 PM UTC

Thanks, it works fine.

Administrator [Syncfusion]
Replied On February 22, 2006 05:47 PM UTC

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

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

;