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.

Grid Grouping Cell Validation

Thread ID:

Created:

Updated:

Platform:

Replies:

46862 Jul 21,2006 07:43 PM Jul 25,2006 04:42 AM Windows Forms 4
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On July 21, 2006 07:43 PM

Hi,
I am using the following code to validate individual cells based on data in other cells of the grid:

protected override void OnTableControlCurrentCellValidating(GridTableControlCancelEventArgs e)
{
string errorMsg;
bool valid = ValidateInput(e.TableControl, out errorMsg);

e.Inner.Cancel = !valid;

if (!valid)
{
e.TableControl.CurrentCell.ErrorMessage = errorMsg;
}

base.OnTableControlCurrentCellValidating(e);
}

My Validate input message returns false for invalid data correctly and e.Inner.Cancel is set correctly to true but the Validation passes and no error displayed, what do I need to do differently?

Thanks,
Will

Administrator [Syncfusion]
Replied On July 24, 2006 12:50 AM

Hi Will,

Our apologizes for the delay in getting back to you.

We have no other reports of this issue, and have not seen it in our many system. Attached sample working fine on my system which has "Essential version 4.2 +Windows XP sp2 +.Net 1.1/2.0" installed.

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/ValidateGrid_4d568772.zip

Exactly what version of Windows XP are you using?

Are you only installing Essential Grid or are you installing Essential Studio? Are you installing binaries only, or the source code version?

What version of the .NET framework and VS are you using?

Have you seen this on multipple systems?

If you give more information about this issue, we will try debugging here.

Regards,
Haneef

Administrator [Syncfusion]
Replied On July 24, 2006 02:43 PM

Hi,
I think the problem may be that in my Validate Input method I am doing the following to extract the input information from the cell. Please let me know if there is a better way to find what the user has input because Record rec = style.TableCellIdentity.DisplayElement.GetRecord(); does not work until EndEdit is called.

Thanks

GridCurrentCell cc = tableControl.CurrentCell;
GridTableCellStyleInfo style = tableControl.GetTableViewStyleInfo(cc.RowIndex, cc.ColIndex);
errorMsg = string.Empty;

bool valid = true;

//Suspend events in the grid in order to extract the value of the cell
cc.SuspendEvents();
try
{
cc.EndEdit();
}
catch (Exception ex)
{
valid = false;
}

>Hi Will,

Our apologizes for the delay in getting back to you.

We have no other reports of this issue, and have not seen it in our many system. Attached sample working fine on my system which has "Essential version 4.2 +Windows XP sp2 +.Net 1.1/2.0" installed.

Here is a sample.
http://www.syncfusion.com/Support/user/uploads/ValidateGrid_4d568772.zip

Exactly what version of Windows XP are you using?

Are you only installing Essential Grid or are you installing Essential Studio? Are you installing binaries only, or the source code version?

What version of the .NET framework and VS are you using?

Have you seen this on multipple systems?

If you give more information about this issue, we will try debugging here.

Regards,
Haneef

Administrator [Syncfusion]
Replied On July 24, 2006 08:16 PM

Another question, how instead of having the error shown as a popup can i have it show as an error in the grid (small red error provider)

Thanks,
Will

Administrator [Syncfusion]
Replied On July 25, 2006 04:42 AM

Hi Will,

Issue 1: Getting Record and Currentcell

You can use the DisplayElement.ParentRecord property to get the corresponding record. but the changes in the currentcell doesn''t reflect the record. If you want to get the modified text of the current cell without calling the EndEdit method or in validating event, you need to use the Renderer.ControlText property. Please find the code snippet below.

//Getting Record
style.TableCellIdentity.DisplayElement.ParentRecord.

//For getting the current record. the changes in the currentcell doesn''t reflect the record
e.TableControl.Table.CurrentRecord

//For getting the modified text of the currentcell
e.TableControl.CurrentCell.Renderer.ControlText.

Issue 2: Error provider in a cell

Please refer the TestErrorProvider browser sample for more details.
C:\Program Files\Syncfusion\Essential Studio\4.2.0.37\windows\Grid.Grouping.Windows\Samples\TestErrorProvider\cs

Let me know if this helps.
Best Regards,
Haneef

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.

;