.NET MVC: How to fix Visual Studio's lack of awareness of CSS classes in partial views?

Posted by Mega Matt on Stack Overflow See other posts from Stack Overflow or by Mega Matt
Published on 2010-03-04T16:04:47Z Indexed on 2010/03/12 17:17 UTC
Read the original article Hit count: 213

Hi all,

This has been sort of an annoyance for me for a while. I make pretty heavy use of partial views in MVC, and am using Visual Studio 2008 to develop. The problem is that when I give html elements a class in a partial view (<div class="someClass">), it will underline them in green like it doesn't know what they are.

I realize this is because I'm in a partial view, and haven't put link tags anywhere in that file for it to know where the CSS is (the link tags are in the main view that renders the partial view). The CSS still works fine on my site because the browser will render all views as one long html page anyway, but it's really annoying to look through my partial views and see all of my classes underlined in green.

Is there a way that I can still tell Visual Studio that those classes exist somewhere, from the partial view? I figured there has to be a way to let it know, but am not sure what it is. Maybe a way to import the stylesheets from the parent view?

Thanks for your help.

© Stack Overflow or respective owner

Related posts about visual-studio

Related posts about css