How do I create a multi line text box in asp.net mvc?
Probably not specific to asp.net mvc but it is what I am using.
Here is what I have.
<%: Html.TextBox("CommentToAdd", null, new { @class = "input-medium", TextMode = "MultiLine", Columns = "55", Rows = "10", type = "text", required = "required" })%>
Following steps are used to set the Multiline property of the TextBox: Step 1 : Create a textbox using the TextBox() constructor provided by the TextBox class. // Creating textbox TextBox Mytextbox = new TextBox(); Step 2 : After creating TextBox, set the Multiline property of the TextBox provided by the TextBox class.
A multiline text box control is a large text box that can display several lines of text or accept this text from user input. Text boxes are often linked to select value lookups and detailed menus. You can place a multiline text box control within a section control.
The <textarea> tag defines a multi-line text input control. The <textarea> element is often used in a form, to collect user inputs like comments or reviews. A text area can hold an unlimited number of characters, and the text renders in a fixed-width font (usually Courier).
A multiline text box allows you to display more than one line of text in the control. If the WordWrap property is set to true , text entered into the multiline text box is wrapped to the next line in the control.
just add this attribute to property.
[DataType(DataType.MultilineText)] public string CommentsToAdd{ get; set; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With