Get the Top Row Index of a Grid Grouping Control

I DO NOT want the TopRowIndex property, I want to know the Row Index where the data starts...
which will be 1 if there are no groups, or captions, but some other number if there are groups, headers, captions, etc...

TopRowIndex only works if the grid is not currently scrolled.

One thing I want to do is SelectAllRows...

The following only works if the grid is not scrolled.
Grid.TableModel.Selections.SelectRange(GridRangeInfo.Rows(Grid.TableControl.TopRowIndex, Grid.TableControl.Model.RowCount), true);


Another thing I need the value for is to Resize the Column Header Row.




1 Reply

MC Mercy C Syncfusion Team April 5, 2012 11:44 AM UTC

Hi Eric,

Thanks for your interest in Syncfusion products.

To get the RowIndex of first record of each group, please make use of the "QueryCellStyleInfo" event.

void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.Column != null && e.TableCellIdentity.Column.Name == "parentID")
{
for (int i = 0; i < e.TableCellIdentity.DisplayElement.ParentChildTable.Groups.Count; i++)
{
row[i] = e.TableCellIdentity.DisplayElement.ParentChildTable.Groups[i].Records[0].GetRowIndex();
}
}
}

To select all the records, you can add the records into "SelectedRecords" collection.

for (int i = 0; i

When you resize the columns, "TableControlResizingColumns" event will be triggered from which you can get the colummn width.

void gridGroupingControl1_TableControlResizingColumns(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlResizingColumnsEventArgs e)
{
int width= e.Inner.Columns.Width;
}

Please refer to the sample in the following link

http://www.syncfusion.com/downloads/Support/DirectTrac/92937/WindowsFormsApplication78 (2)-650776031.zip

Please let me know if you have any concerns.

Regards,
Mercy.C



Loader.
Up arrow icon