Server side validation is done with data annotations instead of doing client side validation
<p>while I was working with validation in MVC, and I wrote a custom attribute to validate a property.Initially the client side validation was not working since attribute was not registered.When i clicked on the <strong><code>save</code></strong> 
 button <em>after contacting the server</em> it was showing the error message.So can anyone tell how this server side validation took place instead of client side validation ?</p>

<p>attribute usage -></p>

<pre><code>[PhoneNumberHasPlus(ErrorMessage="Invalid number")]
public string PhoneNumber {get;set;}
</code></pre>

<p>attribute -></p>

<pre><code> public class PhoneNumberHasPlusAttribute : RegularExpressionAttribute
    {
        public PhoneNumberHasPlusAttribute() :
            base(@"^[+][0-9' '\.\-\(\)]{10,20}$") { }

        public override string FormatErrorMessage(string name)
        {
            if (String.IsNullOrEmpty(ErrorMessage))
                ErrorMessage = "PhoneNumberWithPlus";
            return ErrorMessage;
        }
    }
</code></pre>