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

Adding Validation Display to a Grid without an Editor

1 Answer 11 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Henry
Top achievements
Rank 1
Henry asked on 03 Nov 2015, 10:38 PM

Hi Folks,

I currently have several grids with "Add Row" and "Duplicate Row" buttons. The problem is that the new rows may introduce validation errors in the new model. For example, a required field may be empty, or a field's value may be duplicated (an error in some of our grids). There may even be errors in several rows (e.g. after adding several new rows). I currently have implemented a custom validation that is called on "change" that adds classes and data fields to table cells to make them highlight problems. My approach is similar to the one suggested here (add custom css directly to td cells that violate validation) :

http://www.telerik.com/forums/validation-on-grid-edit---close-cell-with-message

But the problem is that if any more rows are added, removed, etc., the custom formatting disappears. Is there a way to keep the custom css state of cells across grid refreshes? 

Thanks!

 

-Henry

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 06 Nov 2015, 07:30 AM
Hello Henry,

Based on the given information, I believe that the custom styling is lost due to Grid re-render. This would happen if new rows are added or models are updated. If you would like to persist the custom styling added to the cells, then you will need to add it back manually in dataBound event. You can use either the approach for persisting a style state discussed here: or choose your own, that fits your personal preferences.

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Henry
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or