Multiline textbox auto height

Total Post:154


 2751  View(s)
Rate this:

I have multiple multiline textboxes that I fill from a database table. When typing in them the height auto-expands and adjusts in height to the # of rows of text being entered so all rows of text can be seen without scrolling. This is perfect, but when I re-load the page (after I save the textbox data back to the db) the multiline text boxes do not adjust back to the height they should be, showing all rows of data. I figured out a non elegant way to resize the textboxes accordingly. I find the # of characters in the entire multiline textbox, divide that # by the # of characters that can fit in the row based upon the width I've chosen to get the how many rows there should be, multiply that # by the pixel height of a row, and set the textbox height to this # in pixels. There has to be a more elegant way to do this but I can't find it. Anyone have any ideas?

  1. Re: Multiline textbox auto height

    Hi Manoj,

    You could try disabling the multiline property while focus is away from that control, and when you click the textbox to type, you re-enable multiline.

      Modified On Mar-31-2018 12:14:51 AM


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.