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

[Solved] Is it possible to show customized validation message in grid editing?

0 Answers 70 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.
Henry
Top achievements
Rank 1
Henry asked on 22 Jul 2011, 07:45 AM
I have another thread to report bug about this question: 
Possible Bug - ErrorMessageResourceName doesn't work with StringLengthAttribute in grid editing

But I want to describe it more clearly and more easy to answer: Yes or No.

In telerik mvc grid (2011.Q2.712) editing, is it possible to show localized StringLengthAttribute error message defined in metadata annotation like below?

[MetadataType(typeof(WorkflowStatusMetaData))]
public partial class WorkflowStatus
{
}
 
public class WorkflowStatusMetaData
{
    [Required(ErrorMessageResourceName = "Generic_Required", ErrorMessageResourceType = typeof(ErrorMessageCulture))]
    [UIHint("WorkflowTypeDropDownList")]
    public object WorkflowTypeId { get; set; }
 
    [Required(ErrorMessageResourceName = "Generic_Required", ErrorMessageResourceType = typeof(ErrorMessageCulture))]
    [StringLength(50, ErrorMessageResourceName = "Generic_StringLength", ErrorMessageResourceType = typeof(ErrorMessageCulture))]
    public object StatusName { get; set; }
 
    [StringLength(500, ErrorMessageResourceName = "Generic_StringLength", ErrorMessageResourceType = typeof(ErrorMessageCulture))]
    [DisplayFormat(ConvertEmptyStringToNull = false)]
    public object StatusDesc { get; set; }
}

I found the localized information for stringlengthattribute had been loaded into validationMetadata block correctly while grid editing, but grid control always uses validation message from jquery validate script. 

Thanks
Henry
Tags
Grid
Asked by
Henry
Top achievements
Rank 1
Share this question
or