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

Discussion in 'ASP .Net' started by TS, Apr 21, 2004.

  1. TS

    TS Guest

    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?
     
    TS, Apr 21, 2004
    #1
    1. Advertising

  2. 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
     
    Steven Cheng[MSFT], Apr 22, 2004
    #2
    1. Advertising

  3. TS

    TS Guest

    thanks

    "Steven Cheng[MSFT]" <> 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
    >
     
    TS, Apr 22, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AndrewF
    Replies:
    1
    Views:
    784
    Bruce Barker
    Oct 10, 2005
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,984
    Smokey Grindel
    Dec 2, 2006
  3. =?Utf-8?B?QW5kcmV3IEhheWVz?=

    TextBox Within Table Wider Than Cell

    =?Utf-8?B?QW5kcmV3IEhheWVz?=, Sep 27, 2007, in forum: ASP .Net
    Replies:
    3
    Views:
    510
    Just Me
    Sep 28, 2007
  4. OccasionalFlyer
    Replies:
    1
    Views:
    664
    Jukka K. Korpela
    Oct 20, 2011
  5. Tony
    Replies:
    0
    Views:
    816
Loading...

Share This Page