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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Binding to DataTable when cell values are a custom type

Thread ID:





16388 Jul 14,2004 12:23 PM UTC Jul 14,2004 03:32 PM UTC WinForms 2
Tags: Grouping
Daniel Chait
Asked On July 14, 2004 12:23 PM UTC

Say I have a bunch of objects of type Foo and I create a System.Data.DataTable where I add a couple columns like: // START CODE SNIPPET table.Columns.Add("FooColumn1", typeof(Foo)); table.Columns.Add("FooColumn2", typeof(Foo)); // and then add a few rows: for ( int i=0; i < 50; i++ ) { table.Rows.Add(table.NewRow()); for ( int j=0; j < table.Columns.Count; j++ ) { Foo foo = new Foo(); foo.SomeProperty = rand.Next().ToString(); table.Rows[i][j] = field; } } // now assign the datasource gridGroupingControl1.DataSource = table; //END CODE SNIPPET the problem is that I get jillions of exceptions thrown like this: catched at Syncfusion.Grouping.FieldDescriptor.GetValue(Record record) in :line 0 How can I handle the processing myself so that I can tell it how to display a Foo in a cell (assume that there is some processing I need to do for each Foo such as call a custom method or perform some string manipulation)... Thanks - Daniel

Administrator [Syncfusion]
Replied On July 14, 2004 01:26 PM UTC

Hi Daniel, I created a sample for the scenario you described and I found a bug in the FieldDescriptor class. I have that fixed now. If you submit a direct-trac incident we can send you a private patch. With that fix you can display custom types. Just make sure not to use public field in that type. Instead use public properties. I attached the sample form I created. With the fix, you can then add columns to the table descriptor in the form "ColumnName.PropertyName". Form1_9412.zip Stefan

Daniel Chait
Replied On July 14, 2004 03:32 PM UTC

thanks - I created an incident (#12397) for this. - daniel


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon