This is a migrated thread and some comments may be shown as answers.
Telerik.EditorFor with DataAnnotation client validation
0 Answers 24 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Yocheved
Top achievements
Rank 1
Yocheved asked on 22 May 2012, 08:06 AM

Hello,
I'm using EditorFor Telerik extension for a property that is decorated with [Required] attribute of DataAnnotaion. The control is defined into ajax form (by using Ajax.BeginForm )
My problem is that the client validation doesn't work for this control. When the user remain this field empty and clicks on the submit button, the Post action is executed even though the field is required.
Here is the code that decalre the control:

@Html.Telerik().EditorFor(model => model.Description).Name("Description").Encode(false).HtmlAttributes(new { style = "float: left; width: 345px;" }).Tools(tools => tools.Clear().Bold().Italic().Underline().Separator().CreateLink().Unlink())

 @Html.ValidationMessageFor(model => model.Description)


When I replace it to simple Html textbox, It works perfect:

@Html.TextBoxFor(model => model.Description)

@Html.ValidationMessageFor(model => model.Description)


* I'm using in the same page the CurrencyTextBoxFor extensin and it is work perfectly
* I tried replace the ajax form to html form but it also doesn't work.

What can be the reason of this behavior?

Thanks,
Yocheved.

Tags
Editor
Asked by
Yocheved
Top achievements
Rank 1
Share this question
or