Print Page | Close Window

Trigger same validation on two properties ...

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2368
Printed Date: 20-Oct-2025 at 1:51pm


Topic: Trigger same validation on two properties ...
Posted By: as123
Subject: Trigger same validation on two properties ...
Date Posted: 10-Dec-2010 at 4:02pm
          Is it possible to trigger a specific validation based on two properties, but mark only one of the properties as in error on the client? 

          For example, let us say we have FromDate and ToDate properties on an entity. Is it possible to trigger validations when either FromDate or ToDate is changed (which of course, is possible), but notify only ToDate in either case so that only ToDate is shown as in error. Is there any trigger setting which can accomplish this? 

          Currently (DevForce 6.0.6), both properties are shown with error marking (red box around - INotifyDataErrorInfo) on the silverlight client, and the ValidationSummary (Silverlight control) reports the same error twice as both properties are in error.

Thanks



Replies:
Posted By: DenisK
Date Posted: 13-Dec-2010 at 6:05pm
as123;

If I understand correctly, it sounds like what you're trying to do is more of a UI thing than DevForce. You might want to take a look at INotifyDataErrorInfo interface and see what event handler you can customize to achieve what you want to do. 

Also if you're binding to a DataGrid, each cell's error is handled by the following: 

"The DataGrid supports cell-level property validation and row-level object validation. If a validation exception is encountered in the property setter, the cell editing control displays its error state. The  http://msdn.microsoft.com/en-us/library/system.windows.controls.datagridcell.isvalid%28v=VS.95%29.aspx - DataGridCell - .IsValid , and  http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid.isvalid%28v=VS.95%29.aspx - DataGridfalse. The DataGrid will not exit cell editing mode until the validation error is resolved."

This means that you can set DataGridCell.IsValid to true to override the error marking.

Hope this helps.


Posted By: as123
Date Posted: 14-Dec-2010 at 3:01pm
          Thanks.



Print Page | Close Window