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.

SelectionMode.One does not care validation

Thread ID:

Created:

Updated:

Platform:

Replies:

7694 Oct 6,2003 02:44 PM Oct 7,2003 08:05 AM Windows Forms 2
loading
Tags: GridControl
Vladimir Arkhipov
Asked On October 6, 2003 02:44 PM

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!!!

Administrator [Syncfusion]
Replied On October 6, 2003 03:13 PM

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

Vladimir Arkhipov
Replied On October 7, 2003 08:05 AM

Thanks a lot! It works!!!

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.

;