TreeListView Cell Edit Validation

2 posts, 1 answers
  1. Manishkumar
    Manishkumar avatar
    240 posts
    Member since:
    Feb 2009

    Posted 05 Sep 2011 Link to this post

    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.
  2. Answer
    Maya avatar
    4062 posts

    Posted 05 Sep 2011 Link to this post

    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,
    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 >>

Back to Top