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
查看全文
相关阅读:
mysql之innodb_buffer_pool
PBO项目的组织
03 【PMP】组织结构类型的优缺点和适用范围包括哪些
02 【PMP】项目管理系统、PMIS、工作授权系统、配置管理系统、变更管理
01 【PMP】组织结构类型
手工sql注入简单入门
新建oracle用户
linux测试环境搭建步骤
1、python接口测试requests
No module named pip 安装工具提示没有pip模块时,解决办法
原文地址:https://www.cnblogs.com/goldnet/p/1077895.html
最新文章
List转树,寻找树的所有叶子路径
设计模式:责任链模式
NFS搭建和挂载
设计模式:建造者模式
Ftp:文件服务器
Cockpit:一款强大的Linux监控工具
6 二叉树的镜像
5 树的子结构
4 合并两个排序的链表
3 如何进行程序设计才能最有效地解决复杂编程问题
热门文章
2 比较结构体-指针方法和类-引用方法实现二叉树层次遍历效果
1 visual studio code 配置C++开发环境 (windows 开发环境)
SQLSERVER与C#中数据类型的对应关系
BinaryReader 和BinaryWriter 读写类对象
DataTable,DataSet,DataRow与DataView
十分钟了解MVVMLight
MVVM Light 一个窗口承载两个视图
Mvvm Light Toolkit for WPF/Silverlight系列之搭建mvvmlight开发框架
PHP面试题汇总
亿级Web系统搭建——单机到分布式集群
Copyright © 2011-2022 走看看