473,324 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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

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?
Nov 18 '05 #1
2 1968
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

Nov 18 '05 #2
TS
thanks

"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:SC**************@cpmsftngxa10.phx.gbl...
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

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Cemal Karademir | last post by:
Hello, Please forgive my simple question, but i don't know the correct synatx. From the masterpage i want to put a text in an textbox and then select an item in the datagrid. I do know how to...
8
by: tshad | last post by:
I cannot seem to get the asp:textbox to use classes. Style works fine. I am trying to set the textbox to act like a label in some instance so it doesn't have a border, readonly and the background...
2
by: Ali M | last post by:
Hi, I am creating a TextBox dynamically at runtime within a Panel, and I want to bind its Text property to a DataColumn in a DataRow. What is the correct method for doing this... The following...
2
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
4
by: MLH | last post by:
I have a report and on it, a subreport control Main Report Name: rptInvoiceMain Sub Report Name: rptInvoiceSubReport SubReport Control Name: rptInvoiceSubReportCtl The...
16
by: varois83 | last post by:
Hi I hear to set the css width property at 774px which is good for all resolutions. What are you using? Thanks a lot Patrick
1
by: savajx1 | last post by:
I need to dynamically create a set of bound fields contained in a GridView control. I also have a single static CommandField that I can declare in the Columns <tagof the GridView control. I have...
0
by: dan | last post by:
Hi, I have a multi-line textbox in a gridview when in edit mode. The textbox (rendered as textarea in browser) set cols to 20 by default. I'd like the textbox to 'adjust' itself to the width...
1
by: Jeff | last post by:
hi asp.net 2.0 Below is some markup I have trouble with. The problem is that the Textbox doesn't fill the entire DataCell. I've set width of TextBox to 100%.... The point is that I want the *...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.