tags:

views:

732

answers:

4

i have this text box

<p>Event Data :<input  id="data" type="text" wrap="true" value="{{data}}" 
            style="width: 757px; height: 170px" />
    </p>

i want it to be multiline i can't use asp:textbox is it possible to use exact textbox and make it multiline or

make the text in textbox go word wrap

+1  A: 

How about this:

<p>Event Data:
<textarea id="data" style="width: 757px; height: 170px" rows="10" cols="80">{{data}}</textarea>
</p>

Hat tip (and +1) to Stewart for pointing out that rows and cols are required attributes to textarea.

Dominic Rodger
ok good!!thanks a lot
dexter
A: 

You will need to use a <textarea> with a wrap attribute. It is not in any HTML standard but to my knowledge the settings "soft", "hard" and "off" work in all major browsers. Definitely in IE. Firefox seems to require a "cols" setting for wrap to work, though.

Pekka
What `word-wrap` attribute? http://www.w3.org/TR/html401/interact/forms.html#h-17.7
Dominic Rodger
I meant the non-standard `wrap`, corrected accordingly.
Pekka
In which browsers does it not wrap anyway without any such non-standard attribute?
Stewart
+1  A: 
<p>Event Data:
<textarea id="data" rows="10" cols="80">{{data}}</textarea>
</p>

rows and cols are required attributes. Don't ask me why. And if you're going to set the size in CSS, it's generally better to do it in em or % rather than px.

Stewart
A: 

If you mean that you want your text values to display as multi-lines, use add a white-space: pre; style to the textarea element, making sure to put put the proper line-breaks into the returned {{data}}

Dan Gayle