How to validate the input property in Asp.Net MVC ?

Goud.Kv
Posted by Goud.Kv under ASP.NET MVC category on | Points: 40 | Views : 1124
Simple, Below code snippet helps you to achieve easy validation to your input property of a View.

In Model class of your application,

public class myModel {

[Required]
public string EmbedCode { get; set; }

}


The above attribute '[Required]' is used to validate the specified property.
So, User must need to give the EmbedCode in the above example as it is validated.

Comments or Responses

Login to post response