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.
AD
Administrator
Syncfusion Team
April 13, 2005 02:34 PM UTC
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 14, 2005 01:28 AM UTC
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 14, 2005 02:09 AM UTC
Given a GridRecord r, you can find its record index using:
int pos = this.gridGroupingControl1.Table.Records.IndexOf(r);
RI
Richard
April 15, 2005 01:34 AM UTC
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 15, 2005 01:46 AM UTC
Try using:
this.gridGroupingControl1.Table.DisplayElements.IndexOf(r)