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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

emergent help needed on GCC

Thread ID:

Created:

Updated:

Platform:

Replies:

69306 Oct 23,2007 04:44 PM UTC Oct 24,2007 10:41 PM UTC WinForms 2
loading
Tags: Grouping
Wen Jiang
Asked On October 23, 2007 04:44 PM UTC

Syncfusion 4.4.

I use dataTable as the dataSource of a GCC.
The feature I want is when user write data into the GCC and hit key Enter, I want the data in the current cell to be validated in my defined way and pop up error if there is any.

But I haven't found the right event to fire,
I have tried TableControlCurrentCellKeyDown, TableControlCurrentCellKeyPress, but neither accepts key Enter.


Administrator [Syncfusion]
Replied On October 24, 2007 07:51 PM UTC

Hi Jane,

Thank you for your interest in Syncfusion products.

You can validate the cell using CurrentCellValidating event.You can also handle CurrentCellKeyDown and CurrentCellKeyPress events , validate the current cell and display the error message.

The following code snippet validates a double value and changes the message.

You can also use ErroProvider to display the error message.

[C#]

private void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
String s = cc.Renderer.ControlText;
try
{
Double d = double.Parse(s);
}
catch
{
cc.ErrorMessage = "My error message";
}

}

}

Please let me know if this meets your requirement.

Regards,
Jaya

Wen Jiang
Replied On October 24, 2007 10:41 PM UTC

Jaya,

This partially helps.

I tried CurrentCellValidating, CurrentCellKeyPress and CurrentCellKeyDown, all don't pop error even there is error when Enter is hit. Eventually I used CurrentCellValidating, and redirect the focus to the current cell, then it works fine.

Thanks a lot!
Jane



>Hi Jane,

Thank you for your interest in Syncfusion products.

You can validate the cell using CurrentCellValidating event.You can also handle CurrentCellKeyDown and CurrentCellKeyPress events , validate the current cell and display the error message.

The following code snippet validates a double value and changes the message.

You can also use ErroProvider to display the error message.

[C#]

private void gridControl1_CurrentCellKeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;
String s = cc.Renderer.ControlText;
try
{
Double d = double.Parse(s);
}
catch
{
cc.ErrorMessage = "My error message";
}

}

}

Please let me know if this meets your requirement.

Regards,
Jaya

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.

Warning Icon 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.Close Icon

;