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.

Advertisements

January 6, 2012 Posted by | CSS, Error Solutions, MVC | , , , , , | Leave a comment