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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Find Filed for ColIndex, when having multi-row records

Thread ID:





19191 Sep 20,2004 06:25 PM UTC Sep 21,2004 05:18 PM UTC WinForms 2
Tags: GridControl
Asked On September 20, 2004 06:25 PM UTC

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

Administrator [Syncfusion]
Replied On 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 > >


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon