The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
//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
ADAdministrator Syncfusion Team 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; else flag = false; } }