Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I turn an asp:textbox into a multiline <textarea>?

Tags:

I'm using an ASP textbox as a textarea, which I recognize is rendered as an HTML <input type=text>. It has thus far served its intended purpose, with the exception that I cannot get the text to wrap or start at the top.

Here is my markup:

<asp:textbox id="Message_Box" runat="server" mode="multiline" form="Feedback_Form" CssClass="Contact_Input" maxlength="1200" lines="10" cols="10" wrap="true"  /> 

and my CSS:

#Main_Box_Left form textarea, #Main_Box_Left form .Contact_Input {     margin:0;     padding:5px;     height:228px;     width:453px;     max-width:455px;     max-height:230px;     min-height:230px;     font-size:13px;     line-height:20px;        color:rgb(63,69,73);     font-family:Arapey;     font-weight:lighter;     min-width:455px;     margin-top:10px;     background-color:#fcfcfc;     border:1px solid #a9a9a9;     border-top:1px solid #191919;     border-left:1px solid #191919; } 

The "lines", "cols", and "wrap" tags in the ASP component seemingly do nothing.

If there is an alternative tag I should be using as a text area, please advise. If there is a way to wrap the text/make it start at the top, that would be fantastic as well.

like image 764
BTC Avatar asked Jul 24 '13 01:07

BTC


People also ask

How do I make multiple lines in a text box in HTML?

To create a multi-line text input, use the HTML <textarea> tag. You can set the size of a text area using the cols and rows attributes. It is used within a form, to allow users to input text over multiple rows. Specifies that on page load the text area should automatically get focus.

How can make multiline textbox not resizable in asp net?

The solution to this problem is available in CSS3 and fortunately all the three browsers do support CSS3 and hence we can make use of resize CSS property of TextArea. You can either do it by setting it directly in the style attribute.

Can you put a textarea in a form?

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).

What is textarea in asp net?

Let your users type multiline text like notes, comments and descriptions with the ASP.NET Core TextArea. Featuring flexible text-input properties like auto resizing, floating labels and more.


1 Answers

Change mode="multiline" to TextMode="MultiLine" this will render a textarea element

like image 184
Jon P Avatar answered Sep 24 '22 08:09

Jon P