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

Posted on 2006-05-20
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

    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

    Thanks, shortened it a bit:

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

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my 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…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now