This is a migrated thread and some comments may be shown as answers.

TreeListView Cell Edit Validation

1 Answer 104 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Manishkumar
Top achievements
Rank 1
Manishkumar asked on 05 Sep 2011, 07:11 AM
I am using one TreeListView in my WPF application. One of my column is binded with decimal values. So when I edit a cell and enter any invalid value like a string then the cell is getting Red border automatically and does not allow me to lost focus. I want some more validations that should be done on a cell like the following

• Value can have up to one decimal (example: 10.1)
• Allow only numeric values (0 - 9)
• Value entered cannot be > 1000

If the above condition fails then the red border should come. By default the second constion is working fine. Please help me how I will be able to work out the first and last conition.

1 Answer, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 05 Sep 2011, 08:10 AM
Hello Manishkumar,

Actually, the validation you mentioned (entering string value into a numeric field) is handled by the Framework, not by the grid and it is executed during the CellValidating event.
Considering the first requirement, you may use a RadMaskedTextBox as a CellEditTemplate/ or directly GridViewMaskedTextBoxColumn and define the mask you want to be used. As for the last one, you may perform the logic directly in the setter of the property and throw an exception if it does not pass the necessary requirements. 

 

Kind regards,
Maya
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
TreeListView
Asked by
Manishkumar
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or