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
AD
Administrator
Syncfusion Team
July 24, 2006 04:50 AM UTC
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
AD
Administrator
Syncfusion Team
July 24, 2006 06:43 PM UTC
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
AD
Administrator
Syncfusion Team
July 25, 2006 12:16 AM UTC
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
AD
Administrator
Syncfusion Team
July 25, 2006 08:42 AM UTC
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