Can I hide Data errors in edit mode

4 posts, 0 answers
  1. Jason
    Jason avatar
    47 posts
    Member since:
    Jan 2013

    Posted 06 May Link to this post

    I have a gridview that has some errors using DataErrorInfo. When in edit mode, I use cell_validating to potentially set an edit error. However, I then get 2 error controls (red border) overlapping each other. Is it possible to hide or switch off the data layer errors whilst in edit mode?
  2. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    280 posts

    Posted 09 May Link to this post

    Hi Jason,

    Setting the ValidatesOnDataErrors property of RadGridView to "InViewMode" should disable the Error message that comes up from the IDataErrorInfo interface and leave only the validation error related to the CellValidating event. Can you please test setting it and update the thread whether this is the functionality you aim for?

    Regards,
    Stefan Nenchev
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Jason
    Jason avatar
    47 posts
    Member since:
    Jan 2013

    Posted 11 May in reply to Stefan Nenchev Link to this post

    I had the grid set up in that manner already. My actual issue was that the custom editor had the ValidateOnDataErrors property set to true (which was the default). Switching this off on construction of the editor hid the data errors as I wanted.

     

    Thanks

  5. Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    280 posts

    Posted 11 May Link to this post

    Hello Jason,

    Great to hear that you have resolved the validation duplication. I am adding a code snippet on setting the ValidatesOnDataErrors property in CellEditTemplate in case some other member experiences a similar issue:

    <telerik:GridViewDataColumn.CellEditTemplate>
                            <DataTemplate>
                                <TextBox Text="{Binding SomeProperty, ValidatesOnDataErrors=False}"/>
                            </DataTemplate>
    </telerik:GridViewDataColumn.CellEditTemplate>

    In case your scenario is different, you can also add the approach from your end.

    Regards,
    Stefan Nenchev
    Telerik
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Back to Top