Broken rule not shown when navigating in DexExpress.XtraGrid


Author
Message
Chan
Chan
Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I have business rule checking in CheckRulesOnCurrentRow(). When I edit and navigate to row in DevExpress.XtraGrid, error provider doesn't show error sign even there are broken rules. I have set CheckCurrentRowBeforeNavigate to True.

However, It does show error if I bind field to textbox or save record.

Any ideas?

Thank you

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I recommend that you look at the BusinessBindingSource sample that comes with the framework.  If shows how to bind a BO to a grid using a BusinessBindingSOurce while respecting the broken rules and displaying a error provider.
Chan
Chan
Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I have tested BusinessBindingSource sample. However, it doesn't show error provider for required field when navigating row. HOwever, it works for saving record.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Unless you call the CheckRulesOnCurrentRow method the event will not be raised with using a grid when navigating alone.  This is due to the nature of each grid and canceling a row navigation.  You can mange this yourself by calling the CheckRuleOnCurrentRow event in the Navigating event of the BO.  You will then have to cancel navigation yourself on the grid depending upon which grid you are using.
Chan
Chan
Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)Advanced StrataFrame User (723 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi

Thank you for reply. Doesn't grid respect BO.CheckCurrentRowBeforeNavigate ?

StrataFrame Team
S
StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)StrataFrame Developer (4.6K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
The grids do not always respect the CheckCurrentRowBeforeNavigate.  The reason being that they don't use the same mechanism for the record pointer that the business object does.  The grids use the ICurrencyManagerProvider.CurrencyManager.Position property for their record pointer.  When the position within the grid is set, it fires the Navigated event on the business object, which checks the business rules.  However, if the rules fail, the BO cancels navigation and attempts to set the CurrencyManager.Position back to the previous record, however, since this is happening within the PositionChanged event of the CurrencyManager, the CurrencyManager will not respect the request to change the position within the PositionChanged event handler.

So, you're best bet would be to just turn off the CheckCurrentRowBeforeNavigate property and add a handler to the BO's Navigated or Navigating event and manually call CheckRulesOnRow().  It won't prevent the grid from leaving the record, but it will keep the Position and the CurrentRowIndex in sync.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search