textbox property - columns: why does it make width much wider than it needs?

T

TS

If I want a textbox to be wide enough to hold only 2 characters and I set
the columns=2, the textbox ends up being much wider than is necessary. I
would guess that it is as wide as the 2 widest characters as well as to
account for larger fonts, but it seems like its more than enough; any reason
why?
 
S

Steven Cheng[MSFT]

Hi TS,

AS for the width of the ASP.NET TextBox control( in fact it is a <input
type="text" ...> html element), I've also have a test and found that the
"columns" property will work in a certain scope, when the colums's value is
too small, the TextBox will remain a default width. At that time, if we
still want to make its width smaller, we have to set the "Width" property
also, for example:
<asp:TextBox id="TextBox1" runat="server" Font-Size="12pt" Columns="2"
Width="20px"></asp:TextBox>
or you can set it in the textbox's property window.

In fact, this behavior is from the <Input type="text" ..> html element ,
that we have to set its style 's width attribute when we want to make its
width less than a certain small value.

Hope this helps. Thanks.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top