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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Help with rowindex,colindex from SelectedRecordsChanging event of ggc

Thread ID:





58006 Mar 15,2007 06:26 PM UTC Mar 20,2007 08:10 PM UTC WinForms 3
Tags: Grouping
James Blibo
Asked On March 15, 2007 06:26 PM UTC

How do I get the rowIndex and colIndex from the SelectedRecordsChanging event.

I have tried ...

GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
int rowIndex = cc.RowIndex;
int colIndex = cc.ColIndex;

... but this fails when the the current cell is a ComboBox.

I have also tried ...

string tName = e.Table.TableDescriptor.Name;
GridGroupingControl grid = sender as GridGroupingControl;
GridTableControl tc = grid.GetTableControl(tName);

//Disallow selection from colIndex is greater than 8
bool bSuccess = grid.TableControl.PointToRowCol(grid.PointToClient(MousePosition), out row, out col);
if (bSuccess && col > 8){
e.Cancel = true;

//Disallow selection for disabled rows
e.Cancel = !tc.Table.GetTableCellStyle(row, col).Enabled;

but it is always failing, returning -1 for both row and col.

What I am trying to achive is to prevent selection when
1. the row is disabled
2. the current cell column index is greater than 8

Administrator [Syncfusion]
Replied On March 15, 2007 08:39 PM UTC

Hi James,

Thank you for being patience.

A simple way is to handle the QueryCellStyleInfo event and set a Boolean variable for the cell style is enabled. Depending on which the selection of records can be canceled. Please try the following code snippet.
>>>>>>>>>>Code Snippet<<<<<<<<<
bool flag = false;
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
if (e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Record)
if (e.TableCellIdentity.RowIndex > 7)
e.Style.Enabled = false;
else if (e.TableCellIdentity.ColIndex > 8 || !e.Style.Enabled)
flag = true;
flag = false;

void gridGroupingControl1_SelectedRecordsChanging(object sender, Syncfusion.Grouping.SelectedRecordsChangedEventArgs e)
e.Cancel = flag;
>>>>>>>>>>Code Snippet<<<<<<<<<

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,

James Blibo
Replied On March 16, 2007 02:05 PM UTC

I would rather stay away from the QueryCellStyleInfo event. I just need to get the column and row index from within this event.

James Blibo
Replied On March 20, 2007 08:10 PM UTC

Any update on getting the rowindex and colindex from the SelectionChanging event? I do not want to use the QueryCellStyleInfo event...


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