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 and properties of type System.Object

Thread ID:

Created:

Updated:

Platform:

Replies:

34900 Sep 19,2005 02:46 PM UTC Sep 21,2005 04:02 PM UTC Windows Forms 1
loading
Tags: GridControl
Eadred Birchenough
Asked On September 19, 2005 02:46 PM UTC

I''m trying to use a GridGroupingControl to edit a collection of objects representing a Name/Value pair. My underlying object I''ve called SimpleObj, with three properties: Name (String), Type (System.Type), and Value (Object). The intention is that the Type property can help to deserialize the Vale property from a string representation in xml. I''ve used a GridGroupingControl, added three columns, and bound the control to an ArrayList containing some SimpleObjs in order to add, remove, and edit items. The problem is is that whenever I edit the Value in the control, it always comes back to the SimpleObj as DbNull. To keep things as simple as possible I''ve got the following code: Dim m_al As New ArrayList Dim obj1 As New SimpleObj obj1.Name = "Obj1" obj1.Type = GetType(Single) obj1.Value = CSng(0) m_al.Add(obj1) m_grid.TableDescriptor.Columns.Add("Name") m_grid.TableDescriptor.Columns.Add("Type") m_grid.TableDescriptor.Columns.Add("Value") m_grid.DataSource = m_al To see what I can do about the problem I''ve tried two things: 1: Just before the call to m_grid.DataSource I add m_grid.TableDescriptor.Columns("Value").Appearance.AnyCell.CellValueType = GetType(Single) In other words I''m trying hard coding the CellValueType of the value column, since I''m only adding one item which I know to be of type Single. This does not work - I still get DbNull, so I''ve no chance of making it work more generally. 2: I''ve tried using a type converter for the Value property. This overrides the CanConvertFrom/To/ConvertFrom/To functions. It attempts to use the ITypeDescriptorContext parameter to create an inner TypeConverter based on the Type of the SimpleObj (available through ITypeDescriptorContext.Instance property), and just call the equivalent functions on that. The problem with this approah is that (a) the ITypeDescriptorContext is always null so I''ve no way of getting any information about the SimpleObj being converted, and (b) the grid control only seems to call the CanConvertTo function and nothing else. Does anybody know how to cope with properties of type Object? Thanks

Administrator [Syncfusion]
Replied On September 21, 2005 04:02 PM UTC

Hi Eadread, I think the problem you describe is the same as mentioned in this thread: http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=33637 We fixed that for the 3.3 version. Which version do you use and is it it possible for you to test it with the 3.3 version? Thanks, Stefan >I''m trying to use a GridGroupingControl to edit a collection of objects representing a Name/Value pair. > >My underlying object I''ve called SimpleObj, with three properties: Name (String), Type (System.Type), and Value (Object). The intention is that the Type property can help to deserialize the Vale property from a string representation in xml. > >I''ve used a GridGroupingControl, added three columns, and bound the control to an ArrayList containing some SimpleObjs in order to add, remove, and edit items. > >The problem is is that whenever I edit the Value in the control, it always comes back to the SimpleObj as DbNull. > >To keep things as simple as possible I''ve got the following code: > >Dim m_al As New ArrayList >Dim obj1 As New SimpleObj >obj1.Name = "Obj1" >obj1.Type = GetType(Single) >obj1.Value = CSng(0) >m_al.Add(obj1) > >m_grid.TableDescriptor.Columns.Add("Name") >m_grid.TableDescriptor.Columns.Add("Type") >m_grid.TableDescriptor.Columns.Add("Value") > >m_grid.DataSource = m_al > >To see what I can do about the problem I''ve tried two things: >1: Just before the call to m_grid.DataSource I add >m_grid.TableDescriptor.Columns("Value").Appearance.AnyCell.CellValueType = GetType(Single) > >In other words I''m trying hard coding the CellValueType of the value column, since I''m only adding one item which I know to be of type Single. > >This does not work - I still get DbNull, so I''ve no chance of making it work more generally. > >2: I''ve tried using a type converter for the Value property. This overrides the CanConvertFrom/To/ConvertFrom/To functions. It attempts to use the ITypeDescriptorContext parameter to create an inner TypeConverter based on the Type of the SimpleObj (available through ITypeDescriptorContext.Instance property), and just call the equivalent functions on that. > >The problem with this approah is that (a) the ITypeDescriptorContext is always null so I''ve no way of getting any information about the SimpleObj being converted, and (b) the grid control only seems to call the CanConvertTo function and nothing else. > >Does anybody know how to cope with properties of type Object? > >Thanks

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

;