c# : playing with textareas
so... I was playing around with textarea inputs prepopulated by text data from a database. The length of the text field could be wildly varying. If I statically set the rows and cols of the textarea then it may be way too big (if it's a one-line text field that comes back) or way too small.
So I was just playing around with a "function" to dynamically adjust the text area to match the length of the text. It's not perfect.... the only way to control the height is by using the rows argument... style height doesn't do anything. In this case I set the width of the textarea to 500px so you'll need to adjust the function accordingly.
numlines goes in the rows= part of the textarea. It seems that lines that have a newline without any text in it take up less room then rows that do have text in it, hence the nulllinecounter. It's not perfect but it's better than just doing something like