Im using Asp.Net and VB on Visual Studio 2010
Hi, i am using a System.Web.UI.WebControls.TextBox
with the wrap
property set to "true"
, my problem is that when it wraps a word, it moves the whole word to the next line, what i want to accomplish is for the textbox to wrap, but not move the whole word, just move to the new line when the text reaches the right side of the textbox.
Example, imagine a textbox 10 chars wide.
This is what happens:
0123456789
i am a
textbox
This is what i need:
0123456789
i am a tex
tbox
But if i set the wrapping to false, it just will keep expanding the width of the textbox on the same line.
I was thinking of setting the wrap to false, and use the onTextChanged event to check the length of the text and manually trigger the new line. is there any easier way to acomplish this?
Thanks a lot!
This is a web browser implementation issue rather than something that can be accomplished with ASP.NET.
The only way to control that, theoretically, would be to run JavaScript on the client end, but the route would require some heroics. You'd need to
i am a tex<LINEBREAK>tbox
"), that way you can discern real linebreaks from the user with the linebreaks that the JS puts in to chop off the end of the line<LINEBREAK>
s replaced with empty strings.But all of the above would require an enormous amount of effort, lots of testing across the various browsers, and breaks some of the built-in ASP.NET stuff (i.e., not using the contents of a textbox but rather a client side INPUT).