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

Find Filed for ColIndex, when having multi-row records

I was using ColIndexToField before in my code that determines the field under the current cell. Now I started using LayoutColumns method to make a long record span several lines. ColIndexToField is no use anymore, because it does not take RowIndex as a parameter, and thus cannot give me the proper Field name. Please advice, how do I figure out the Field name from an event, such as CurrentCellValidated or QueryCellInfo, when the only thing that is available to me is RowIndex and ColIndex. Thanks.

2 Replies

AD Administrator Syncfusion Team September 21, 2004 12:19 AM UTC

Hi Jeck, I think the following code should do it: GridBoundRecordState state = binder.GetRecordStateAtRowIndex(e.RowIndex); GridHierarchyLevel level = binder.GetHierarchyLevel(state.LevelIndex); fieldNum = level.RowFieldToField(state.row, fieldNum); GridBoundColumnsCollection columns = level.InternalColumns; if (fieldNum >= 0 && fieldNum < columns.Count) { GridBoundColumn columnStyle = columns[fieldNum]; } Stefan


AD Administrator Syncfusion Team September 21, 2004 05:18 PM UTC

Thanks! Works great! I think this is a nice topic for Knowledge Base. Few other people at our company were puzzled too. >Hi Jeck, > >I think the following code should do it: > > >GridBoundRecordState state = binder.GetRecordStateAtRowIndex(e.RowIndex); >GridHierarchyLevel level = binder.GetHierarchyLevel(state.LevelIndex); >fieldNum = level.RowFieldToField(state.row, fieldNum); >GridBoundColumnsCollection columns = level.InternalColumns; >if (fieldNum >= 0 && fieldNum < columns.Count) >{ > GridBoundColumn columnStyle = columns[fieldNum]; >} > > >Stefan > >

Loader.
Up arrow icon