How to make a auto resize textbox/textfield in asp.net?

Question by lidude56910: How to make a auto resize textbox/textfield in asp.net?
i want a textbox in asp.net to auto resize by giving font size and font family and my textbox width. i wan to observe the paragraphs and word wrap!
So in load i give font-size, font-family and the text and its width (i don’t need to change the width) and it should automatically increase the height of textbox!

doesn’t matter: vb.net, c#, javascript, jquery!
THANKS A MILLION.

Best answer:

Answer by auddrey_nw
http://forums.asp.net/t/1459368.aspx

or use the following method You should call it anytime your TextField’s content changes

function Autosize(txt:TextField):void
{
//You set this according to your TextField’s dimensions
var maxTextWidth:int = 145;
var maxTextHeight:int = 30;

var f:TextFormat = txt.getTextFormat();

//decrease font size until the text fits
while (txt.textWidth > maxTextWidth || txt.textHeight > maxTextHeight) {
f.size = int(f.size) – 1;
txt.setTextFormat(f);
}

}

What do you think? Answer below!

About Admin