Rad grid unique row validation

2 posts, 1 answers
  1. Rajendar
    Rajendar avatar
    69 posts
    Member since:
    Jun 2013

    Posted 22 Aug Link to this post

    Hi Everyone,

    I have a unique required. I want show error when two rows are same. In attached image table all rows are valid rows except last and first rows. I want show error at first and last row. Can please help me here.

    Note: There is no unique Column values.

     Regards,

    Rajendar. 

  2. Answer
    Yoan
    Admin
    Yoan avatar
    1066 posts

    Posted 25 Aug Link to this post

    Hello Rajendar,

    What you can try is to add an additional property of type boolean in your object. After building your source, you can traverse it and set the "duplicate" flag with your own code. In this way, you will have an additional column in the grid which will hold an information whether the row is duplicated. Then you can benefit from our RowStyleSelector. You can use it in order to style the duplicate rows. It will be something similar to this:

    public override Style SelectStyle(object item, DependencyObject container)
           {
               if (item is MyObject)
               {
                   MyObject myObject = item as MyObject;
                   if (myObject.IsDuplicate)
                   {
                       return DuplicateStyle;
                   }

    I hope this will work for you.

    Regards,
    Yoan
    Telerik by Progress
    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
Back to Top