views:

24

answers:

1

I am doing some validation in the OnChanging event of Linq-to-sql model partila class and want to fire an error into my model. is this possible?

event code

> partial void OnCommissionStartChanging(System.DateTime value)
>     {
>         if (this.CommissionStart > this.CommissionEnd)
>         {
>             //add error to model or throw exception to model
>             return;
>         }
> 
>         this.CommissionStart = value; 
> 
>     }
+1  A: 

Implement IDataErrorInfo. Don't throw an exception, because even with HandleError the user will get a generic error page (wrong) instead of seeing their form with ValidationSummary (right)

Craig Stuntz