Asp.net mvc 3: Strange Validation

Posted by coure06 on Stack Overflow See other posts from Stack Overflow or by coure06
Published on 2011-02-07T07:14:46Z Indexed on 2011/02/07 7:25 UTC
Read the original article Hit count: 159

Filed under:
|
|

I have applied DataAnnotation based validations to two of my properties like this

[Required(ErrorMessage = "Title is required")]
public string Title { get; set; }

[Required(ErrorMessage = "Description is required")]
public string Description { get; set; }

Here is the view page's code

    @Html.LabelFor(model => model.Obj.Title)
    @Html.EditorFor(model => model.Obj.Title)            

    @Html.LabelFor(model => model.Obj.Description)
    @Html.TextAreaFor(model => model.Obj.Description)     

The Problem is that on click of submit button, on client side (js) its only giving me error for for Title and not for the Description. But Its giving me validation error for the Description after the postback.

What possible causes?

© Stack Overflow or respective owner

Related posts about c#

Related posts about JavaScript