Automatically adjust TextBox's height

Discussion in 'ASP .Net Web Controls' started by H., Jun 29, 2005.

  1. H.

    H. Guest

    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.
    H., Jun 29, 2005
    #1
    1. Advertising

  2. 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.
    --
    Staff Consultant II - Enterprise Web Services - Cardinal Solutions Group

    Future Business Model - National City Mortgage


    "H." wrote:

    > 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.
    Michael Baltic, Jun 29, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. GhislainTanguay

    How to adjust the height between two rows

    GhislainTanguay, Oct 14, 2003, in forum: HTML
    Replies:
    1
    Views:
    595
    Steve Pugh
    Oct 14, 2003
  2. Cal Who
    Replies:
    1
    Views:
    913
    Cal Who
    Jun 2, 2010
  3. SalamOnAltern

    adjust the row height for some rows

    SalamOnAltern, Jun 7, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    121
    SalamOnAltern
    Jun 7, 2006
  4. active

    Can't adjust table height

    active, Apr 3, 2007, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    105
    active
    Apr 3, 2007
  5. MattB
    Replies:
    0
    Views:
    105
    MattB
    Aug 6, 2004
Loading...

Share This Page