Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > textbox property - columns: why does it make width much wider than it needs?

Reply
Thread Tools

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

 
 
TS
Guest
Posts: n/a
 
      04-21-2004
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?


 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      04-22-2004
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

 
Reply With Quote
 
 
 
 
TS
Guest
Posts: n/a
 
      04-22-2004
thanks

"Steven Cheng[MSFT]" <v-> wrote in message
news:...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why is the border on top much wider Tony ASP .Net 0 11-12-2011 09:30 AM
Making Table Text wider (other than "width") OccasionalFlyer HTML 1 10-20-2011 09:43 PM
TextBox Within Table Wider Than Cell =?Utf-8?B?QW5kcmV3IEhheWVz?= ASP .Net 3 09-28-2007 08:36 AM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger ASP .Net 2 12-02-2006 03:46 PM
Textbox width scaling to width of data not width of page? AndrewF ASP .Net 1 10-10-2005 04:38 PM



Advertisments