Learn how to a build a cloud-first strategyRegister Now


CSS class attribute removed in rendered HTML

Posted on 2009-02-18
Medium Priority
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
  • 2
LVL 15

Expert Comment

ID: 23675988
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

ID: 23676496
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

aibusinesssolutions earned 150 total points
ID: 23676549
With the asp:Hyperlink, format it like so.

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Screencast - Getting to Know the Pipeline
Suggested Courses

810 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