23 thoughts on “Unobtrusive Client Validation with MVC 3 + Razor in C#”

    • Hi vaibhav,

      You can try something like this (see below):

      [Required(ErrorMessage = "Please enter a your age.")]
      [Display(Name = "Age:")]
      public int Age { get; set; }

      The first line means it is a mandatory field, thus it cannot be empty.
      The second line is just for the label.
      The third line where you set the type as “int” would mean that it will only accept integers.


  1. I am really impressed with your writing skills as well as with the format on your weblog. Is that this a paid subject matter or did you customize it yourself? Anyway keep up the excellent quality writing, it is uncommon to peer a great blog like this one today..

  2. I must say, youve got 1 with the ideal blogs Ive observed in a lengthy time. What I wouldnt give to be capable of produce a blog thats as interesting as this. I guess Ill just need to keep reading yours and hope that one day I can write on a topic with as much understanding as youve got on this one!

  3. Dude, please tell me that youre going to write additional. I notice you havent written another blog for a while (Im just catching up myself). Your blog is just too critical to be missed. Youve got so much to say, such understanding about this subject it could be a shame to see this weblog disappear. The net desires you, man!

  4. Pingback: http://virginieetendsonlinge.zeblog.com/348571-hoolidayys/

  5. Pingback: Homepage

Leave a comment