Home > DeveloperSection > Forums > Multiline textbox auto height
Manoj Bhatt
Manoj Bhatt

Total Post:153

Points:1079
Posted on    September-03-2013 7:21 AM

 C# C# 
Ratings:


 1 Reply(s)
 1422  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?



Sumit Kesarwani

Total Post:378

Points:2694
Posted on    September-03-2013 7:51 AM

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.


Don't want to miss updates? Please click the below button!

Follow MindStick