CSS and control name mangling in content pages

Posted by flashnik on Stack Overflow See other posts from Stack Overflow or by flashnik
Published on 2010-04-11T18:58:59Z Indexed on 2010/04/11 19:03 UTC
Read the original article Hit count: 270

I have a simple website with a master-page. To set properties to elements on a content page (such as Textbox) I use CSS. In designer it works well but when I launch a site a style isn't apllied to controls. The reason is simple. To say, I have a TextBox with id="TextBox1" in content page, it is placed in ContentPlaceHolder1. In CSS file I set properties for object with id #TextBox1. When I launch a site due to master page name mangling it gets an id like ctl00_ContentPlaceHolder1_TextBox1 which is not defined in CSS file included in masterpage.

What is a correct solution of this problem? Hardcoding mangled name doesn't seem to be good.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about name-mangling