Ticket T552184
Visible to All Users

Validate all grid rows

created 8 years ago

Hi,

I have a requirement to validate all rows in a grid, the scenario is that when the user changes the frequency field the other lines still need to be valid.
In the attached example, if you change the row with 12M to 3M this should invalidate all four rows as 12M should appear once and 3M three times, I have a validation attribute attached to the observable collection which fires and returns false in my application - not in the attached one - but doesn't invalidate the row.

The cell validation works, however even though I have EnableImmediatePosting set to true, the cell still doesn't update until it loses focus, I guess this is because I am nulling the value in code, if you can suggest a better method for both of these that would be appreciated.

Thanks
Justin

Answers approved by DevExpress Support

created 8 years ago (modified 8 years ago)

Hello,
Although it's not possible to accomplish this task using attributes, you can use the ValidateCell event instead. To force the validation process when the IDataErrorInfo interface is used, it's necessary to raise the PropertyChanged event for a corresponding data item. First, you need to create a certain public method at your MaintenanceLineFrequency class level to call its OnPropertyChanged method. After that, subscribe to the ValidateCell event using our EventToCommand behavior to handle it at your ViewModel level. In this event handler, iterate through your MaintenanceFrequencies collection, check its items and call your method to raise the PropertyChanged event. Please try this approach and provide us with your results.
As for your question about updating a cell's value, to process your post more efficiently, I've created a separate ticket on your behalf (a GridControl cell isn't immediately updated when it's activated and its value is changed in code). It has been placed in our processing queue and will be answered shortly.

Thanks,
Kirill

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.