-
Notifications
You must be signed in to change notification settings - Fork 0
14 TextArea and Resize Handle
M. Fares edited this page Apr 22, 2018
·
3 revisions
To change a textbox to a textarea, your need to include the annotation [DataType(DataType.MultilineText)] with the property in view model.
Example: File: /ViewModels/CourseViewModel.cs Property: Description
Example of generated code (use Inspect tool to see the textarea tag): File: /Views/Course/Create.cshtml Property: Description
Note: The textarea resize handle is supported in Chrome and Firefox. It is not supported IE and Edge, your need to use JQuery plugin.
To set the number of rows of a textarea. In the view add the rows attribute
@Html.EditorFor(model => model.Description, new { htmlAttributes = new { @class = "form-control", @placeholder = "Put your description", rows = 5} })