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

[Solved] MVC Grid customizing edit rows

1 Answer 87 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brian
Top achievements
Rank 1
Brian asked on 21 Jul 2010, 06:33 PM
I am working with the mvc grid and I have a few text columns and one checkbox column.  Does anyone know how to customize editable items such as textboxes and checkboxes when a row is being edited?   I want to be able to set a max length on the edit textboxes and enable the checkbox in the checkbox column for editing.  Thanks...

1 Answer, 1 is accepted

Sort by
0
Roland
Top achievements
Rank 1
answered on 15 Apr 2011, 04:03 PM
Wow! 9 months and no answer. Well I have the same problem and what I discovered is that it doesn't look like you can set maxlength without creating a ClientTemplate which is tedious. You can however decorate your editable property in you entity class with a "StringLength" Attribute as follows.

public class EditableEntity
{
    [StringLength(10, ErrorMessage = "The {0} value cannot exceed {1} characters. ")]
    public string Name {get; set;}
}

This and other System.ComponentModel.DataAnnotations attributes work with Telerik grid version 2011.1.315. Can't speak for earlier versions though.
Tags
Grid
Asked by
Brian
Top achievements
Rank 1
Answers by
Roland
Top achievements
Rank 1
Share this question
or