Automatically adjust TextBox's height

H

H.

Hi,

I have a questions regarding the TextBox webcontrol. I already have a
textbox in fix width. But the number of contents (text) in the textbox is
arbitrary. I set the textbox as mutlilines. I want to dynamically adjust the
textbox 's height to fits for the number of characters in the textbox so as
not to show vertical scroll bar. For instance , if there are 3 rows , the
textbox's height equals to 3 rows , if there are 5 rows , the textbox's
height equals to 5 rows. How can I do this ?

Thank you,
H.
 
M

Michael Baltic

You would need to default it to multiline, with 1 row and set the style to
hide the scrollbars. Then in Javascript, change the number of lines based on
the number of characters entered.

An asp textbox renders an input type=text when the control is single line
and a textarea when the control is multiline.

So, you won't be able to dynamically change it from single to multi on the
client.

It is trivial on the server.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top