i am using the following code to validate a field in a row, in a xamdatagrid. when it shows my message and i click ok it removes all data from the row. I do not want the other entered data to be cleared because a required field was not entered, i want the user to go fix this one field and submit all data.
if (string.IsNullOrEmpty(patient.ID)) { var message = new AcknowledgeDialogBox(SmartLinkStrings.MsgPatientID, null); message.ShowDialog(); e.Record.CancelUpdate(); }
Hello,
I am just checking if you require any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
I have been looking into the issue that you have described and you can enable leaving the Add New Record by handling the KeyDown event of the XamDataGrid and using a Boolean variable that is set to true when the Escape key is pressed and in the RecordUpdating event if this variable is true, you can call the CancelUpdate method of the e.Record. I have modified the sample application that I have sent you with my previous reply in order to follow this approach.
If you have any further questions on the matter please do not hesitate to ask.
this solution works great, except if you want to exit the grid without adding a row. once inside the row i can not leave unless i make it a valid row and actually save it.
I have been looking into the functionality that you are looking for and I assume that you are using the RecordUpdated event and validating the AddNewRecord in the XamDataGrid. If my assumption is correct I can suggest using the RecordUpdating event instead. In the event handler you can set the e.Action to CancelUpdateRetainChanges if the validation fails and force the cell that does not pass the validation to edit mode using DataResenterCommnands. I have created a sample application for you, which demonstrates how the approach I have suggested can be implemented.
Please let me know if this is what you are looking for, or I have misunderstood you in any way.