开发者

Adding a reference to a css file in an ascx file in vs2008 only to get intellisense

开发者 https://www.devze.com 2022-12-22 22:13 出处:网络
Normally visual studio brings up intellisense for available css classes, which it draws from css files linked to the current aspx/master document.

Normally visual studio brings up intellisense for available css classes, which it draws from css files linked to the current aspx/master document.

Is there a way to get this to work in an ascx file in a similar way to ref开发者_如何转开发erencing external JavaScript files in js files for the purpose of intellisense

/// <reference path="jquery-1.4.1.js" />

I only want this for the purpose of intellisense and not getting squiggly lines under un-recognised classes. My css files will be actually linked from the aspx/master page.


Why don't you just add the css file to your ascx file, which will give you the Intellisense, and then add a line of server side code to the ascx file as well, which will only include the css file if a certain variable is set in web.config for instance ?

<%if(Convert.ToBool(ConfigurationManager.AppSettings["DevelopMode"])%>
 <link href="MyCssFile.css" rel="stylesheet" type="text/css" />

That would give you the IntelliSense, but would include the css file from the master page when the application is running.

0

精彩评论

暂无评论...
验证码 换一张
取 消