textbox style wrecked in firefox by VS 2003 (replaces style attrib with height/width)

Posted on 2006-05-20
Medium Priority
Last Modified: 2012-05-05
I have a multiline textbox that shows great in IE (matches what shows in VS design view), but shows way too small in FF.  Under View | Source I could see that the CSS got dropped when serving FF!  So I replaced "asp:textbox height=100 width=100" with "asp:textbox style="height: 100px; width: 100px;", and everything looked great in both browsers!  Until I switched between design and html views in VS.  It replaces my style attribute with the height/width attributes, and goes back to serving the CSS to IE, but not to FF.

Need the CSS served to both browsers, or some way to keep VS from wiping out the CSS I type in the editor.

Thanks for any help/explanations.  

Question by:ottenm
LVL 27

Accepted Solution

Sammy earned 375 total points
ID: 16726987
add this in the head of the aspx page
<style type="text/css">
.Txt {
      height: 100px;
      width: 100px;
in your code behind
me.txtID.Attributes.Add("Class", "Txt")

This should fix it for both browsers and the VS.NET IDE can not change whats not there since it will be set on runtime :-)

just dont forget to replace txtID with your textbox ID


Author Comment

ID: 16739105
Thanks, shortened it a bit:

me.MyTextBos.Attributes.Add("style", "height: 208px; width: 616px;")

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question