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
查看全文
相关阅读:
mingw-gcc-9.0.1-i686-posix-sjlj-201903
MSYS 编译 nginx rtmp-module
MinGW GCC 8.3.1 2019年2月23日 出炉啦
城市区号SQL
HCN网络技术实验指南2
HCN网络技术实验指南1
CCNA实验攻略1:配置Cisco交换机
HCDA-7-配置ssh远程管理
HCDA-6-配置telnet远程管理
4.1 子网划分基础
原文地址:https://www.cnblogs.com/goldnet/p/1077895.html
最新文章
Winform中设置ZedGraph的多条Y轴的标题和刻度不显示十次幂
Express中app.use中间件的用法-匹配所有的请求方式
Express的基本路由实现对get和post等的请求和响应
Node的Web应用框架Express的简介与搭建HelloWorld
python实现随机生成头像
linux系列(十六):which命令
搭建自己的博客(二十四):使用自定义模板标签来优化代码并实现评论计数
搭建自己的博客(二十三):添加回复功能
linux系列(十五):tail命令
搭建自己的博客(二十二):通过ajax提交评论信息,并增加公式编辑功能
热门文章
搭建自己的博客(二十一):通过django表单实现登录注册
搭建自己的博客(二十):优化博客评论功能
linux系列(十四):head命令
搭建自己的博客(十九):添加简单的评论功能
OpenCL32 for mingw
ffmpeg 视频过度滤镜 gltransition
node.js ffmpeg-concat 命令行形式处理多个视频的过度效果
MinGW GCC 9.1 2019年5月3日 出炉啦
西瓜视频蓝光1080P下载方法
c++17 代码你能看懂吗?
Copyright © 2011-2022 走看看