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.

Find Filed for ColIndex, when having multi-row records

Thread ID:





19191 Sep 20,2004 02:25 PM Sep 21,2004 01:18 PM Windows Forms 2
Tags: GridControl
Asked On September 20, 2004 02:25 PM

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.

Administrator [Syncfusion]
Replied On September 20, 2004 08:19 PM

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

Administrator [Syncfusion]
Replied On September 21, 2004 01:18 PM

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 > >


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.

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.