I have the following Model Class validation:
public class Group_validation
{
[Required]
[StringLength(50)]
public string Name { get; set; }
[DataType(DataType.MultilineText)]
[StringLength(200)]
public string Description { get; set; }
}
But currently I have the following questions:
How I can define the number of columns and rows for the
DataType(DataType.MultilineText)]
the
StringLenght
data annotation client side validation will stop working when I add theDataType(DataType.MultilineText)].
so in my case the StringLenght will work as a the client side validation for the Name field, but will only work only as a server side validation for the Description field.
Can anyone advice how to solve this issue?
You could make it with the help of HTML Helper class
@Html.TextAreaFor(model => model.Description, new {cols = 50, rows = 5})