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
查看全文
相关阅读:
Nbear实体和接口 CodeSmith模版
prototype1.4版中文参考手册(word,pdf,chm)
SharePoint 2013 (SharePoint 15)的新特性
没有域环境下安装SharePoint 2010
产品经理(PM)常用原型图设计工具
【转贴】mysql导入数据load data infile用法
重新学javaweb!
关于HIbernate中的lazy属性的一些解释
JAVA程序员基本测试题目
添加sql server约束
原文地址:https://www.cnblogs.com/goldnet/p/1077895.html
最新文章
混乱2007
在Firefox下面浏览btchina的方法
文本框高度自适应
隔行,滑动,点击 变色.+ 多选框
集折叠、选项卡、焦点图的封装,简单实用
点击加减或手动改变表单值
一个js下拉菜单 类似jq效果
jquer和JS版:网页标题闪烁 title标题闪烁
js弹窗,自动判断显示上下位置!!
简易的点击展开/关闭效果(原生JS版和JQ版)
热门文章
折叠菜单
JS无间隙滚动向左、向右、向上、向下兼容IE,firefox
css 左右两栏 左边固定右边自适应
JS延时加载面向对象版
Javascript表单验证大全
那些年,和你一起吃路边摊的姑娘
getElementsByClassName的理想实现
修改的梅花雪的日期控件。。只是一些小改动
SQL Serve中实现字符串分割(split)的功能函数
一个下拉联动控件的实现
Copyright © 2011-2022 走看看