文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > IT/计算机 > Dll控件里含图片,JS,CSS
侵权投诉

Dll控件里含图片,JS,CSS

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 =

第1页

你可能喜欢

热门文档

相关文档

  • HTML+CSS+JS

    HTML+CSS+JS_计算机软件及应用_IT/计算机_专业资料...表格背景图片的路径 Bgcolor:表格的背景颜色 ...1)变量 2)数据类型 3)运算符 4)程序控件语句 …...

  • IIS7无法显示htmjs图片css的解决方法

    IIS7无法显示htmjs图片css的解决方法_电脑基础知识_IT/计算机_专业资料。IIS7无法...开始->控件面板->程序->打开或关闭windows功能->Internet信息服务->万维网服务-...

  • html+div+css+js

    18、在 HTML 页面中包含一个按钮控件 mybutton,如果要实现点击该按钮时调用已...div+css+js基础-自己整理... 20页 免费 javascript图片动态显示 3页 1下载券...

  • js生成或删除控件

    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]

    C# DLL资源文件打包(图片、JS、CSS)[WebResource]_IT/计算机_专业资料。很好的...在用户控件中注册资源(也可以在AssemblyInfo.cs中) 基本上看到的都是在DLL内部...

  • Html_Js_cssWeb基础教程

    创建有声有色的网页 设置图片尺寸,边框,位置,如何...学会使用 Input 标签建立各种表单控件,使用下拉列表和...(html css js) ,~'~'~._ (((\\~ _~'~....

  • html 随笔记录(css的style让控件透明,iframe背景透明,...

    html 随笔记录(css的style让控件透明,iframe背景透明...fsadfasdllcowry于2007年11月16日8点00分00秒说 ...在主页面有一个整体的背景颜色或者背景图片的时候,i...

  • 兼容所有浏览器的CSS圆角框JS组件

    兼容所有浏览器的CSS圆角框JS组件_IT/计算机_专业资料。大家在网页设计的时候,为了页面效果更为美化会用到圆角框,大家一般情况下 都会采取用图片堆砌做成圆角框效果,...

  • 前台编码规范(Html, JS, CSS)

    前台编码规范(Html, JS, CSS)_互联网_IT/计算机_...标签在 IE 浏览器中可 能无法加载背景图片。 为确保...3.5 对象及控件 ? 公司目前无专职前台工程师,JS ...

  • js_css文件合并

    js_css文件合并_理学_高等教育_教育专区。js_css文件...\php\php5apache2_2.dll" PHPIniDir "C:/php/"...搞笑图片乐翻人 cs3简单制作动态搞笑图片81...

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email