RadGridView display cells for multiple error when loading

4 posts, 0 answers
  1. Tan
    Tan avatar
    5 posts
    Member since:
    Dec 2012

    Posted 18 Jun 2014 Link to this post

    Hi Telerik, 

    I would like to do like this: When I load the RadGridView (NOT when I validate cells), it will show me all the data with cell that has errors will be highlighted/ border by red color. If there are multiple errors in different cells, all the error cells will have red border color with tooltip.   

    How can I do this?
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 20 Jun 2014 Link to this post

    Hi,

    You can check the Validating documentation on the validation options we suggest.

    Then, you can try setting the ValidatesOnDataErrors="InViewMode" after the data has been loaded. 

    Regards,
    Didie
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. Tan
    Tan avatar
    5 posts
    Member since:
    Dec 2012

    Posted 20 Jun 2014 in reply to Dimitrina Link to this post

    I try using cell validation, look like this one:

    private void radGridView_CellValidating( object sender, Telerik.Windows.Controls.GridViewCellValidatingEventArgs e )
    {
    if ( e.Cell.Column.UniqueName == "OrderNO" )
    {
    if ( e.NewValue.ToString().Length < 5 )
    {
    e.IsValid = false;
    e.ErrorMessage = "OrderNO must be longer than five characters.";
    }
    }
    }

    and set ValidatesOnDataErrors="InViewMode" but no validation is made when the radGridView is loaded.

    Can you help? Thanks.


  4. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 20 Jun 2014 Link to this post

    Hello,

    This validation will take effect when the CellValidating event is raised. It will be raised for a cell when you commit editing a cell. Therefore, this code will not be executed initially.
    You can implement the IDataErrorInfo interface to get the validation initially.

    Regards,
    Didie
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top