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.
Hi,
I have a grid control with single selection mode:
gridControl1.ListBoxSelectionMode = SelectionMode.One;
I want to use my custom validation, so I added handler to CurrentCellValidating event
It validates fine, prevents me from moving to another sell from keyboard, but mouse click moves selection to another row:(.
Test code is simple like this:
private void gridControl1_CurrentCellValidating(object sender, CancelEventArgs e)
{
e.Cancel = gridControl1.CurrentCell.Renderer.ControlText.Length > 3;
}
Please Help!!!
ADAdministrator Syncfusion Team October 6, 2003 07:13 PM UTC
The validation only affects moving the current cell but not selecting cells. That's why you see this odd effect in that special case.
Add the following event handler to ensure that you cannot move the selection when the current cell is invalid:
void OnSelectionChanging(object sender, GridSelectionChangingEventArgs e)
{
if (CurrentCell.IsModified)
{
CurrentCell.Validate();
if (!CurrentCell.IsValid)
e.Cancel = true;
}
}
Stefan