How can i change the controls error state while running the business rules manually

How can i change the controls error state while running the business rules manually

Old forum URL: forums.lhotka.net/forums/t/9745.aspx


tikluganguly posted on Thursday, November 11, 2010

Hi All,

           I have a form with some silverlight data bound controls along with the csla propertystatus controls. Now the business object it is bound to, have some business rules in it. If I am explicitly making changes to the data in the control which in turn triggers any validation error i am getting a nice red error message, all this is getting handled by csla and working excellent.

     Again say the user has entered some value and hits the done button in the form i am running the rules by using the code

         this.BusinessRules.CheckRules(); 

  for the business object. I am also getting individual errors from brokenrulescollection. Which at present I am displaying in a messagebox.

  What I want is a way to set the controls in errorstate where ever the rule is broken instead of displaying the messagebox. Is there any easy way to do that?

Hope I was been able to describe my problem

Regards

TIklu

RockfordLhotka replied on Thursday, November 11, 2010

After calling CheckRules, make a call to OnUnknownPropertyChanged - that will raise appropriate PropertyChanged events and should get you the desired result.

tikluganguly replied on Friday, November 12, 2010

Thanx Rocky it worked perfectly :)

Copyright (c) Marimer LLC