This question is locked. New answers and comments are not allowed.
Hi,
I am using Telerik controls for Silverlight 5.
I need to set the Unique key validation for a cell.
On the "CellValidating" event, I am sending the cell value to the database and checking the value.
Here the problem is with the asyncronous Domain service.
I am using the MVVM architecture and Domain service. I have implemented the "CellValidating" event in the view model and in that event I am calling the service method as below.
And the opearation completed method is as below:
Here the problem is, we can know whether it is unique or not in the opration completed event,
but there I cant set the error message as I cant access that cell there.
How can I set the error message to that cell in the operation completed event.
Or is there any way I can get the value from the domain service, in the CellValidating event itself.
FYI: I am returning a scalar value from the domain service.
Please help.
Regards,
SivaPrasad.B
I am using Telerik controls for Silverlight 5.
I need to set the Unique key validation for a cell.
On the "CellValidating" event, I am sending the cell value to the database and checking the value.
Here the problem is with the asyncronous Domain service.
I am using the MVVM architecture and Domain service. I have implemented the "CellValidating" event in the view model and in that event I am calling the service method as below.
public void CellUniqueValidation(object obj) { GridViewCellValidatingEventArgs e = (GridViewCellValidatingEventArgs)((Emps.ExtendedCommandParameter)(obj)).EventArgs; var currentColumn = e.Cell.Column as IDataGridColumn; //pointer to the cell's column if ((currentColumn != null)) //both are present { var newData = e.NewValue == null ? "" : (e.NewValue).ToString(); //get the new value var oldData = e.OldValue == null ? "" : (e.OldValue).ToString(); //get the old value if (currentColumn.GridColumnIsUnique && newData != "") { //CheckUniqueness _context.CheckUniqueness("Employee", "emp_id", operation => { operation.Completed += new EventHandler(Uniqueness_operation_Completed); }, null); //e.ErrorMessage = "This is unique"; //set the error massage //e.IsValid = false; //return; } } }And the opearation completed method is as below:
void Uniqueness_operation_Completed(object sender, EventArgs e) { if (((System.ServiceModel.DomainServices.Client.InvokeOperation<bool>)(sender)) != null) { if (((System.ServiceModel.DomainServices.Client.InvokeOperation<bool>)(sender)).Value) { //We can get the value here } } }Here the problem is, we can know whether it is unique or not in the opration completed event,
but there I cant set the error message as I cant access that cell there.
How can I set the error message to that cell in the operation completed event.
Or is there any way I can get the value from the domain service, in the CellValidating event itself.
FYI: I am returning a scalar value from the domain service.
Please help.
Regards,
SivaPrasad.B