How to limit the Textbox's Width????

G

Guest

Hi everyone,
I have a number of textboxes, lined up in a html table. I have split the table into different columns. The column widths are all relative, that is, % rather pixels or points so that it can grow / shrink. The textboxes are then placed into table cells and have their widths to be 100% of the width of their container (table cells). Example <table id="Table1" width="100%" ....> <tr> <td width="20%">First Label column</td> <td width="15%"> <asp:textbox id="TextBox1" Width="100%" Runat="Server"></asp:textbox> </td> <td width="20%">Second Label column</td> <td width="15%"> <asp:textbox id="TextBox2" Width="100%" Runat="Server"></asp:textbox> </td> <td width="*"> </td> </tr> </table>

When I display the text in TextBox1. If the text is long, the textbox automatically resizes to display whole string and pushes everything on the right to the right. I don't want this, is there a way to stop it from expanding beyond its allocated space?

Any help is greatly appreciated.
Thanks,
Calvin
 
G

Guest

Calvin:

If you use relative resizing you cannot cap the maximum width of the textbox. The best you can do is to optimize the display to a particular resolution and inform the users of your application that “it is best viewed with†that particular resolution. You can also have some server-side code that verifies the size of the data fields that will populate the textbox and then adjust the textbox width accordingly.
 
G

Guest

Thanks for your response Phillip. I was hoping for a more favourable solution but i guess we've reached its limitation.

Cheers,
Calvin
 
Joined
Apr 3, 2008
Messages
1
Reaction score
0
1 Solution : - regarding controlling the size of textboxes

Dear Friends!


regarding controlling the size of textboxes,

style="width:50px"

Yes, it helped me!

M
 
Joined
Feb 12, 2013
Messages
1
Reaction score
0
as simple as that .................
add
style="table-layout:fixed;"
in the table containg this text box... it works for me.
 

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

No members online now.

Forum statistics

Threads
548,042
Messages
3,104,223
Members
248,131
Latest member
Tonypshaw1

Latest Threads

Top