CSS class attribute removed in rendered HTML

Posted on 2009-02-18
Last Modified: 2012-05-06
I am try to apply a CSS class to an anchor element in an ascx control, however when the HTML is rendered the class attribute is removed. I am using IE 7.0. No clue as to why it is doin this.
In code: <a href="UpdateContact.aspx" class="alertMessage"><u>here</u></a> 

in browser-source: <a href="UpdateContact.aspx"><u>here</u></a>

CSS class



 color: #660000;


Open in new window

Question by:LVMiner
    LVL 15

    Expert Comment

    Hmm, that could be a couple different things.

    If you are using a the built in local web server, it may be stuck caching an older page, you can right click it in your system tray and stop it then browse to it again.  For IIS just do an iisreset from Start>Run.

    If not, does the <a> tag have a runat="server" tag?  Is that the exact code pasted from your code?

    Are you using an asp:HyperLink?

    Author Comment

    Tried resetting local IIS and emptying IE 7 web cache files with negative results. The code is exact as pasted. Going to try the asp:Hyperlink to see if this is a solution.
    LVL 15

    Accepted Solution

    With the asp:Hyperlink, format it like so.

    <asp:HyperLink runat="server" CssClass="alertMessage" NavigateUrl="updatecontacts.aspx"><u>Here</u></asp:HyperLink>

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
    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.
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    728 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

    18 Experts available now in Live!

    Get 1:1 Help Now