ASP.NET MVC - CSS class in ViewUserControl - class or CssClass not defined

I have <table/>in ViewUserControl that I gave the tag "tblRaised" attribute / value. Visual Studio saves the base tblRaised and tells me: the class or CssClass is not defined.

Why is the intellisense engine trying to check my CSS class names here? Anyone else come across this? This is mistake? How would intellisense even know where my css file was in ViewUserControl?

+2
source share
3 answers

Since styles are usually included in your view or main page, VS cannot find them in your ViewUserControl. If you add something like the following to your ViewUserControl, you can work around the problem (and get intellisense) by not including CSS twice.

<% if (false) { %>
   <link rel="stylesheet" type="text/css" ...
<% } %>

This will get intellisense since it can find the stylesheet, but using if (false) actually prevents it from being included at runtime.

+4
source

, ASP.NET( MVC) . VS , intellisense aspx . MVC , , , .

, , 1.0.

+1

. Visual Studio IntelliSense .:)

, VS IntelliSense :

<% if (false) { %><link href="../../Content/Css/MyCssDefinitions.css" rel="Stylesheet" type="text/css" /><% } %>
+1

Source: https://habr.com/ru/post/1702986/


All Articles