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

Retrieve Bound Object from GridGroupingControl in PrepareViewStyleInfo

Hi, I have a gridgroupingcontrol bound to an arraylist of my custom objects (say clsItem). in the PrepareViewStyleInfo event, how can I return the object bound to the row that raised the event? I need to color the cell/row based on the value of one of the object''s properties. I have some code from the non-grouped bound grid, but can''t seem to get it to work. Thanks very much in advance, Damien Sawyer

1 Reply

AD Administrator Syncfusion Team August 2, 2005 08:43 AM UTC

Try code like this. GridTableCellStyleInfo style = e.Inner.Style as GridTableCellStyleInfo;; GridRecordRow rr = style.TableCellIdentity.DisplayElement as GridRecordRow; if((style.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell || style.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell) && rr != null && rr.ParentRecord != null) { object o = rr.ParentRecord.GetData(); Console.WriteLine(o); }

Live Chat Icon For mobile
Up arrow icon