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
查看全文
相关阅读:
后端——框架——容器框架——spring_boot——《官网》阅读笔记——第五章节1(Actuator)——待补充
后端——框架——容器框架——spring_boot——《官网》阅读笔记——第九章节2(Build Tool Plugins——Other)——待补充
后端——框架——容器框架——spring_boot——《官网》阅读笔记——第九章节3(Build Tool Plugins——Other)——待补充
后端——框架——容器框架——spring_boot——《官网》阅读笔记——第九章节4(Build Tool Plugins——Other)——待补充
后端——框架——容器框架——spring_boot——《官网》阅读笔记——第九章节5(Build Tool Plugins——Other)——待补充
后端——框架——容器框架——spring_boot——《官网》阅读笔记——第九章节6(Build Tool Plugins——Other)——待补充
后端——框架——容器框架——spring_boot——《官网》阅读笔记——第九章节7(Build Tool Plugins——Other)——待补充
后端——框架——容器框架——spring_boot——《官网》阅读笔记——第九章节8(Build Tool Plugins——Other)——待补充
过敏体质是一种什么样的体验
工作簿拆分(Excel代码集团)
原文地址:https://www.cnblogs.com/goldnet/p/1077895.html
最新文章
Android自定义控件:动画类(七)----属性动画ValueAnimator高级进阶(二)
Android自定义控件:动画类(六)----ValueAnimator高级进阶(一)
Android自定义控件:动画类(五)----属性动画ValueAnimator基本使用
解决checkbox在滑动时选中状态错乱的问题
android打造万能适配器
RecyclerView的使用
IntentFilter的匹配原则
Android获取百度天气接口
一些设置
数据库和java的类型转化
热门文章
pdf 使用模板下载
读取页面传的数据
mysql-scott用户的表的创建
存储过程procedure
Eureka 整理
spring cloud 概念
css 样式通用样式
原生 js 整理
后端——框架——容器框架——spring_boot——《官网》阅读笔记——第八章节3(Build Tool Plugins——Ant)——待补充
后端——框架——容器框架——spring_boot——《官网》阅读笔记——第八章节4(Build Tool Plugins——Other)——待补充
Copyright © 2011-2022 走看看