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

Is current row a header row

how can I test to find out if the current selected row is a grouping/header row, or a regular record in a grouping grid. NOTE: i need to find this out from a non grid event, ie. a non grid button click.

5 Replies

AD Administrator Syncfusion Team April 13, 2005 09:34 AM

Hi Rich, you can check groupingGrid.Table.CurrentElement is Record or groupingGrid.Table.CurrentElement is CaptionRow or groupingGrid.Table.CurrentElement is HeaderRow Stefan >how can I test to find out if the current selected row is a grouping/header row, or a regular record in a grouping grid. > >NOTE: i need to find this out from a non grid event, ie. a non grid button click.


RI Richard April 13, 2005 08:28 PM

Thanks Stefan, that does the trick, just a couple of things though. When you guys post replies, could you make everything verbose, eg. it took me a while to find out that Record was actually in the Syncfusion.Grouping namespace. Thanks Also, is there a simple way to get the record index, in the same circumstances. I am getting it using a different method, but it is creating a bit of overhead


AD Administrator Syncfusion Team April 13, 2005 09:09 PM

Given a GridRecord r, you can find its record index using: int pos = this.gridGroupingControl1.Table.Records.IndexOf(r);


RI Richard April 14, 2005 08:34 PM

Thanks, I have used the following code GridRecord r = (GridRecord)this.grdGrpObjects.Table.CurrentElement; int pos = this.grdGrpObjects.Table.Records.IndexOf(r); but this returns the row number of records only, and does not take grouping records into account. Grouping records cause this to fail. I need to get the the value including grouping headers. eg. this does what I want but has too much overhead, being executed over and over. private void grdGrpObjects_TableControlPrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlPrepareViewStyleInfoEventArgs e) { System.Console.WriteLine(e.Inner.RowIndex.ToString()); }


AD Administrator Syncfusion Team April 14, 2005 08:46 PM

Try using: this.gridGroupingControl1.Table.DisplayElements.IndexOf(r)

Loader.
Live Chat Icon For mobile
Up arrow icon