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.

Date Validation Failure

Thread ID:

Created:

Updated:

Platform:

Replies:

51638 Nov 9,2006 03:38 PM Nov 23,2006 05:20 PM Windows Forms 4
loading
Tags: Grouping
Administrator [Syncfusion]
Asked On November 9, 2006 03:38 PM

Hi,

I'm currently trying to handle date validation within a cell and when validation fails the focus doesn't seem to set back to the cell properly.

If you see in the attached project when an invalid date is entered, for example 6/ , a message box is displayed. I'd like for the cursor to be placed back in the cell and the user to be able to type again. Right now we're forced to click the cell again in order to enable editting.

I have also tried handling the TableControlCurrentCellConfirmChangesFailed event to call BeginEdit(true); on the cell but this does not work.

DateValidation0.zip

Administrator [Syncfusion]
Replied On November 10, 2006 07:26 AM

Hi Paulo,

We will work out for a solution and let you know the details soon. Thanks for being patience.

Best regards,
Haneef

Administrator [Syncfusion]
Replied On November 21, 2006 10:53 AM

Any word on this yet?

Administrator [Syncfusion]
Replied On November 23, 2006 12:37 AM

Hi Paulo,

Our apologies for the delay in response.

You can handle the CurrentCellValidating event and use the MoveTo method to activate the currentcell. Here is a code snippet

private void gridGroupingControl1_TableControlCurrentCellValidating( object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e )
{
if ( e.TableControl.CurrentCell.Renderer.StyleInfo.CellValueType == typeof( DateTime ) )
{
object cellVal = e.TableControl.CurrentCell.Renderer.ControlValue;
string cellText = e.TableControl.CurrentCell.Renderer.ControlText;

if ( ( cellVal == null )
&& ( ( cellText != String.Empty )
|| ( cellText != null ) ) )
{
MessageBox.Show( "error" );
e.Inner.Cancel = true;
int row = e.TableControl.CurrentCell.RowIndex;
int col = e.TableControl.CurrentCell.ColIndex;
e.TableControl.CurrentCell.MoveTo(row, col, GridSetCurrentCellOptions.SetFocus);

}
}
}

Sample : ModifiedWindowsApplication3.zip

Best Regards,
Haneef

Administrator [Syncfusion]
Replied On November 23, 2006 05:20 PM

This appears to work. Thank you

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.

;