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

Help with rowindex,colindex from SelectedRecordsChanging event of ggc

Thread ID:

Created:

Updated:

Platform:

Replies:

58006 Mar 15,2007 02:26 PM Mar 20,2007 04:10 PM Windows Forms 3
loading
Tags: Grouping
James Blibo
Asked On March 15, 2007 02:26 PM

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;
return;
}

//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 04:39 PM

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;
else
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,
Madhan

James Blibo
Replied On March 16, 2007 10:05 AM

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 04:10 PM

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

CONFIRMATION

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.

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.

;