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. Image for the cookie policy date

Nested properties, column binding

In http://www.syncfusion.com/support/forums/printthread.aspx?MessageID=15123 you suggested handling a nested object property by using gbc.MappingName="IncType" and then retrieving the object through e.style.cellvalue and then setting e.style.text to the nested property. The problem is that when the object is assigned to the MappingName it''s ToString gets used and the object retrieved through e.style.cellvalue is a system.string, not the object. I''ve tried both prepareviewstyleinfo and model.querycellinfo. How do you go about retrieving the actual object from e.style.cellvalue? TIA

3 Replies

AD Administrator Syncfusion Team December 8, 2004 06:19 PM UTC

Are you setting the CellValueType for this cell? If so, then CellValue should return the proper type if it is assigned the proper object. There is another way you can handle showing nested properties. You can add unbound columns to manage this, and have your Parent class implement ITypedList to help with providing values through QueryCellInfo and SaveCellInfo events. Here is a little sample.

DE Dave Erwin December 9, 2004 10:58 AM UTC

No, I wasn''t setting the CellValueType, but now I''m having trouble figuring out how to do that. My first thought is to set it with .styleinfo.cellvaluetype when the gbc is being setup before it is added to the grid. I''ve tried .styleinfo.cellvaluetype=gettype(IncType) but in querycellinfo the e.style.cellvalue.gettype.tostring still says that it is system.string. Is this the correct way to set the cellvaluetype? Are there any plans to make nested properties easier? Is it changed in 3.0? Thanks for the clue anyway.

AD Administrator Syncfusion Team December 9, 2004 11:53 PM UTC

That is how you woudl try to set the CellValueType, using teh GridBoundColumn.CellCalueType. In 3.0, the GridGourpingControl deos a better job of using nested properties. But the support in teh GriddataBoundGrid is the same. If you can post a sample project showingteh problem you ar ehaving (or submit a Direct Trac incident with a sample),we can try to see if we can get it working.

Live Chat Icon For mobile
Up arrow icon