Dll控件里含图片,JS,CSS
Listing 1: AssemblyInfo.cs entries
[assembly: System.Web.UI.WebResource("myImage.gif", "img/gif")]
[assembly: System.Web.UI.WebResource("myStylesheet.css", "text/css")]
[assembly: System.Web.UI.WebResource("myJavascript.js", "text/js")]
Namespace Note
The project’s default namespace (defined in the Application tab of the project's Properties page) will be added as a prefix to the filename of embedded resources. In this case, I’ve set the default namespace to an empty string. Otherwise, the tag’s first parameter would need to be DefaultNamespace.Filename.Extension instead of simply Filename.Extension. (This was the biggest pitfall I encountered because it wasn’t obvious that the namespace would be added as a prefix, and so I was referencing the resources by their short names when I should have been using the long format.)
Accessing the Embedded Resource
To add the embedded resource to our ASP.NET page, we will be calling the ClientScriptManager’s GetWebResourceUrl method. Its first parameter is the Type of the control’s class (which will eventually provide .NET with an assembly reference where the embedded resource is contained) and its second parameter is the name of the resource as specified in the AssemblyInfo.cs file. For example, to load an image in an Image control, use the code in Listing 2. To add a stylesheet to the Page header area, use the code in Listing 3. To render a JavaScript include tag, use the code in Listing 4.
Listing 2: Setting an image control’s source
Image theImage = new Image();
theImage.ImageUrl =
Page.ClientScript.GetWebResourceUrl(this.GetType(), "myImage.gif"); Listing 3: Adding a stylesheet to the page header
string includeTemplate =
HTML+CSS+JS_计算机软件及应用_IT/计算机_专业资料...表格背景图片的路径 Bgcolor:表格的背景颜色 ...1)变量 2)数据类型 3)运算符 4)程序控件语句 …...
IIS7无法显示htmjs图片css的解决方法_电脑基础知识_IT/计算机_专业资料。IIS7无法...开始->控件面板->程序->打开或关闭windows功能->Internet信息服务->万维网服务-...
18、在 HTML 页面中包含一个按钮控件 mybutton,如果要实现点击该按钮时调用已...div+css+js基础-自己整理... 20页 免费 javascript图片动态显示 3页 1下载券...
value="图片文件:" name="txt'+i+'"><INPUT type="file" size="21" ..."css/bs.css" type="text/css" rel="stylesheet"> <LINK href="css/...
C# DLL资源文件打包(图片、JS、CSS)[WebResource]_IT/计算机_专业资料。很好的...在用户控件中注册资源(也可以在AssemblyInfo.cs中) 基本上看到的都是在DLL内部...
创建有声有色的网页 设置图片尺寸,边框,位置,如何...学会使用 Input 标签建立各种表单控件,使用下拉列表和...(html css js) ,~'~'~._ (((\\~ _~'~....
html 随笔记录(css的style让控件透明,iframe背景透明...fsadfasdllcowry于2007年11月16日8点00分00秒说 ...在主页面有一个整体的背景颜色或者背景图片的时候,i...
兼容所有浏览器的CSS圆角框JS组件_IT/计算机_专业资料。大家在网页设计的时候,为了页面效果更为美化会用到圆角框,大家一般情况下 都会采取用图片堆砌做成圆角框效果,...
前台编码规范(Html, JS, CSS)_互联网_IT/计算机_...标签在 IE 浏览器中可 能无法加载背景图片。 为确保...3.5 对象及控件 ? 公司目前无专职前台工程师,JS ...
js_css文件合并_理学_高等教育_教育专区。js_css文件...\php\php5apache2_2.dll" PHPIniDir "C:/php/"...搞笑图片乐翻人 cs3简单制作动态搞笑图片81...
热门文档