Unknown CSS class on Razor-constructed class names
Hello All,
I have many CSS classes that are created in Razor views at runtime, based on values contained in the model. e.g.
Snippet
<div class="row search-results search-results-@searchResultsLayout.ToLower()">
This div tag will have a final class that is one of a predetermined set of layouts. In this case, it is a Bootstrap sizing identifier, so it will be either "search-results-gridsm" or "search-results-gridlg".
However, R# clearly cannot look into a model at design time, so its Intellisense identifies "search-results-" as an unknown CSS class.
I do this "runtime class construction" in my Razor quite a lot, so I have a lot of distracting Intellisense warnings.
The only way out of this I can find (aside from turning off all such warnings) is to litter my code with disable/restore comment pairs around every such instance.
Is there another way around this?
Thanks!
Jeff Woods
Reading, PA
Please sign in to leave a comment.