zoukankan
html css js c++ java
使用ASP.NET 2.0提供的WebResource管理资源
ASP.NET 2.0提供的Web Resources管理模型,很好的解决了image、css、script等外部资源的管理问题
在自定义控件中加入(
放在最高级namespace外就行
。
)
[assembly: WebResource(
"
WebCtrl.cutecat.jpg
"
,
"
image/jpg
"
)]
[assembly: WebResource(
"
WebCtrl.cutecat.js
"
,
"application/x-javascript
"
)]
代码:
WebResource Demo
#region
WebResource Demo
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Text;
using
System.Web.UI;
using
System.Web.UI.WebControls;
[assembly: WebResource(
"
WebCtrl.cutecat.jpg
"
,
"
image/jpg
"
)]
namespace
WebCtrl
{
[DefaultProperty(
"
Text
"
)]
[ToolboxData(
"
<{0}:WebCustom runat=server></{0}:WebCustom>
"
)]
public
class
WebCustom : WebControl
{
private
string
text;
private
Image m_Image;
[Bindable(
true
)]
[Category(
"
Appearance
"
)]
[DefaultValue(
""
)]
public
string
Text
{
get
{
return
text; }
set
{ text
=
value; }
}
protected
override
void
CreateChildControls()
{
m_Image
=
new
Image();
this
.Controls.Add(m_Image);
}
protected
override
void
Render(HtmlTextWriter output)
{
m_Image.ImageUrl
=
this
.Page.GetWebResourceUrl(
typeof
(WebCustom),
"
WebCtrl.cutecat.jpg
"
);
this
.RenderChildren(output);
}
}
}
#endregion
查看全文
相关阅读:
node学习报错之883
vue-cli4创建项目
Decorator学习笔记
合天网安实验室学习笔记----Linux基础
IDF实验室解题学习笔记1
QA笑话----杂思
测试优先
Python的IDE:Eclipse+PyDev配置
JS实现浏览器的title闪烁
JSTL实现分页
原文地址:https://www.cnblogs.com/goldnet/p/1077895.html
最新文章
java面试题
通过JMETER后置处理器JSON Path Extractor插件来获取响应结果
使用Jmeter做接口测试(学生信息的6个接口)
使用Postman做接口测试(学生信息的6个接口)
Am335x u-boot 代码大概流程
AM335x启动
硬件小知识
关于ARM的开发环境IAR工程的配置问题
ARM开发板不工作的几个原因
硬件设计
热门文章
深入剖析——float之个人见解
如何将Emmet安装到到 Sublime text 3?
github如何切换到指定的分支
The selector should be prefixed by "app" (https://angular.io/guide/styleguide#style-02-07)
comment must start with a space (comment-format)tslint(1)
Not using the local TSLint version found for XXX
对修饰器的实验支持功能在将来的版本中可能更改。在 "tsconfig" 或 "jsconfig" 中设置 "experimentalDecorators" 选项以删除此警告。ts(1219)
如何在项目开发中使用github
ng6中使用socket.io报global is not defined错误
node学习之第一个服务器
Copyright © 2011-2022 走看看