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

Rad grid unique row validation

1 Answer 31 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rajendar
Top achievements
Rank 1
Rajendar asked on 23 Aug 2016, 03:34 AM

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. 

1 Answer, 1 is accepted

Sort by
0
Accepted
Yoan
Telerik team
answered on 25 Aug 2016, 10:08 AM
Hello ,

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.
Tags
GridView
Asked by
Rajendar
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or