I had a phone number in which the entered data should be only numeric. I would like to differentiate it in Model some thing like..
[Required]
//i want to place some thing here//
public string PhoneNumber
{
get;
set;
}
Can any one please help me to find the solution..
You could do this with a
[RegularExpressionAttribute][1]That regular expresion just allows numbers (like you asked) but you could use a more complex regular expression to allow a certain format of phone number if you want to be more strict, for example see http://regexlib.com/DisplayPatterns.aspx?cattabindex=6&categoryId=7