How to change the number of columns and rows for my DataType (DataType.MultilineText)]

advertisements

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:

  1. How I can define the number of columns and rows for the DataType(DataType.MultilineText)]

  2. the StringLenght data annotation client side validation will stop working when I add the DataType(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})