By Ross L. Rooker, Sr. - 10/24/2010
I have a form where a column by default for a form should always be disabled for a certain user unless there is a broken rule on that column. The broken rule logic is in the BO in the CheckRulesOnCurrentRow. Right now when the user click EDIT, certain columns should always be disabled unless there is a broken rule.
My issue is how do I enable a column on the form IF that column has a broken rule and the return the column enable.not enabled back to what it was after the user clicks SAVE.
The BO may be used from multiple forms so trying to hanle setting a column on a form for a broken rule will probably need to be done from the form. So how do I intercept this on a column when the form shows the red error pointing to the column and make the column enabled?
|
By Greg McGuffey - 10/25/2010
You might try adding a boolean property to the BO (not a custom bindable one, just a regular .NET one) that you set in the broke rule event handler of the BO. Normally you just setup UI related stuff for the user, so they know what's wrong and how to fix it. However, in your case, if a certain column is broken (and maybe only in a certain way) you need to take other action, so set this new property to true. In the AfterSave event of the BO, clear it. Now the BO is providing information about the issue. You'll use events to test this property and take the appropriate action.
Then on the form, you'd need to do three things, all to handle the enabled state of your column manually.
- Set the IgnoreManageUIReadonlyState of the control displaying this column to true. This tells the BO to NOT enable/disable the control automatically.
- Handle the BusinessRulesChecked event of the BO on the form. Check the boolean property mentioned above and set enabled accordingly.
- Handle the AfterSave event of the BO on the form and disable the column.
That should get you going in the right direction.
|
|