We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

ASP.NET TextBox with percentage width problem

syinner
syinner asked
on
Medium Priority
1,047 Views
Last Modified: 2012-05-06
Hi There, I have an ASP.NET application that is built around a table design. I having odd results in IE and Firefox with a TextBox with percentage width.

As I use this for error messages such as stack traces, instead of scrolling it creates all sorts of havoc with the page.

Any help would be great
<tr><td>Error Message:</td></tr>
<tr><td><asp:TextBox ID="txtErrorMessage" runat="server" Font-Size="Small" Width="80%" TextMode="MultiLine" Height="400"></asp:TextBox></td></tr>

Open in new window

Comment
Watch Question

Top Expert 2009

Commented:
Sorry, but what exactly is the issue here?

Author

Commented:
When I set the textbox with a percentage width I am having unpredictable results. One is when I retrieve a stack trace from the database and insert it into the textbox, weird things start to happen.

I have attached a example of the textbox content.
example-error.txt
Can you post a sceen shot to help us understand your problem?

Author

Commented:
As you can see in the example when I put the stack trace into the textbox it throws my alignment out. The column and the textbox size increase. I would expect the textbox to scroll instead? I also put a wrap on the textbox.
example2.doc
Have you tried using a fixed width on the TextBox?

Author

Commented:
A fixed width works fine. I am hoping that the textbox (textarea) can cope with a percentage width or a way to make it do so?
No. The percentage width means to be changing, it is why it is also called fluid width. If you want to keep the layout the same no matter what screen size the client PC is using, then you should use the fixed width.
You can check the styles used at EE web site and you will find a lot of fixed width, that is why EE's layout is very consistent. The fixed width gives you more control of the layout than the percentage width.
Commented:
After a lot of searching I found a resizable jquery plugin.

http://plugins.jquery.com/project/TextAreaResizer

Works like a treat!

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.