Last post Apr 15, 2008 07:27 PM by Ricardojb
Apr 10, 2008 06:49 PM|Ricardojb|LINK
I have a composite control that is quite complex.
Among other things, it displays TextBox. The TextBox control is inside an UpdatesPanel and causes a postback to update a database.
Each TextBox is multiline. I have a request to dynamically resize the Textbox to fit the content without showing scrollbars.
It doesn't have to be done on the client side, they are ok with the control showing scrollbars while they are typing on it, but once they move to another area, they want it to show the entire content without scrolling.
the Textbox has a little used property named Columns. If I set the Columns property, then it would be quite easy to know how many rows to have.
However, setting the Columns property will give the control a fix width which I don't want to.
I thought about determining the number of columns based on the screen resolution, but that wouldn't work because although I can find out what the screen resolution is I can't know what the screen size is.
I thought of developing a control that would switch between a label and a Textbox, but I wonder if someone has better ideas.
Apr 14, 2008 09:03 AM|Hua-Jun Li - MSFT|LINK
Then you can use it at web page.
<asp:TextBox ID="TextBox5" runat="server" Height="48px" Width="436px" TextMode="MultiLine"></asp:TextBox><br />
<body onload="Resize();" onresize="Resize();">
public partial class Now_Test1 : System.Web.UI.Page
Let me know if I have misunderstood what you mean.
Hope it helps,
Apr 15, 2008 07:27 PM|Ricardojb|LINK
Thanks Li (it's your first name right?)
I think you understood it right, I will give it a try and let you know.