Validating phone number javascript Online sex chat karachi without registration

Posted by / 15-Sep-2017 01:21

Validating phone number javascript

It is not yet linked with the User Profile model class.

To attach the metadata defined in the User Profile Metadata class to the User Profile class you need to add a partial class to the project and then use the [Metadata Type] attribute as shown below: As you can see the User Profile class is a partial class and has [Metadata Type] attribute on top of it.

In this example you validate the Phone property with a regular expression for US phone numbers.

At this stage, the User Profile Metadata class is just an independent class in your project.

Add the following code to the Home Controller class.

The Home Controller class contains two versions of the Index() action method.

The [Metadata Type] attribute accepts the type of the class that is supplying metadata information to the User Profile class (User Profile Metadata in this case).

The second Index() method accepts User Profile as a parameter. The Is Valid property returns false if any of the properties contain invalid values.

Then add a new SQL Server database named User Db to the App_Data folder and create a table - User Profile.

The User Profile table has columns as shown in the following figure: The User Profile table As you can see from the above model class, the User Profile table consists of eight columns, viz.

For example, the [String Length] attribute used on the First Name property specifies the maximum length for First Name to be 50 and Minimum Length to be 3.

The Error Message property of the data annotation attribute indicates an error message that will be displayed in case there is any validation error.

validating phone number javascript-34validating phone number javascript-30validating phone number javascript-84

The [Range] attribute checks whether a property value falls between a minimum and a maximum value.