I am using asp.net mvc 4 i am using [maxlength(2)] in my model but it is not working on client side validation i am new to asp.net mvc .here is my code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
namespace RestrauntsMVC.Models
{
public class Restraunts
{
public int id { get; set; }
[Required]
public string name { get; set; }
[Required]
[MaxLength(2),MinLength(1)]
public int rating { get; set; }
[Required]
public string location { get; set; }
}
}
Answering myself to help future readers.I found out Maxlength and Minlength is for String not for integer.