Chuck's Code Blog

Assorted solutions and musings

Suppress Those “CssClass not defined” issues in MVC.

I found a hack to suppress those CssClass not defined issues in MVC! The hack is to wrap duplicate link references (they already exist in our MasterPage) in a False evaluator (if loop) up in our “content3” area as shown below. Note that runat=”serverVisible=”false” attribute key \ value pairs have been added to the end of each link.

    <% if (false) { %>
        <link href="~/Content/WebFramework/Site.css" rel="stylesheet" type="text/css" 
runat="server" Visible="false" />

        <link href="~/Content/Site.css" rel="stylesheet" type="text/css" 
runat="server" Visible="false" />

        <link href="~/Content/WebFramework/smoothness/jquery-ui-1.8.11.custom.css" 
rel="stylesheet" type="text/css" runat="server" Visible="false"/>

        <link href="~/Content/WebFramework/DataTables/dataTables.custom.css" 
rel="stylesheet" type="text/css" runat="server" Visible="false" />

    <% } %>

I’ve also seen where people have created a SupressWarnings.css that have empty classes defined so technically they are defined even though practically they do nothing from a CSS point of view.


January 6, 2012 - Posted by | CSS, Error Solutions, MVC | , , , , ,

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: