Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Increase the size of TextArea in html razor view mvc4?

I have one text area field called Description in my view. I wish to increase the size of that field.

My code

  <div class="col-sm-3">
  <div class="form-group">
  <span style="color: #f00">*</span>
   @Html.LabelFor(model => model.Description, new { @class = "control-label" })
   @Html.TextAreaFor(model => model.Description, new { @class = "required", style = " rows=10, columns=40" })
   @Html.ValidationMessageFor(model => model.Description)
       </div>
     </div>

My TextArea

TextArea

I want to bring as like which is mention in the below image

Wanted Output

So i gave Rows and columns in textarea field. It increase the size of the text area. But when i shrink the page to phone size means all fields got shrink . But this textarea field is not shrink up to the page size. This is the issue

I kept validation for my fields. I want to show that validation in Red color. I'm using Model validation.

like image 643
Susan Avatar asked May 03 '16 04:05

Susan


1 Answers

Try This:

  @Html.TextAreaFor(model => model.Description, 10,40, htmlAttributes: new {style="width: 100%; max-width: 100%;" })
like image 62
error_handler Avatar answered Sep 21 '22 07:09

error_handler