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
查看全文
相关阅读:
combineByKey
reduceByKey和groupByKey的区别
Spark-Streaming之window滑动窗口应用
归并排序
SparkSQL的3种Join实现
大数据面试题及答案
Spark-Join优化之Broadcast
Spark map-side-join 关联优化
解决spark中遇到的数据倾斜问题
Greenplum-cc-web安装
原文地址:https://www.cnblogs.com/goldnet/p/1077895.html
最新文章
【mysql】MySQL存储IP地址
ogg 12c OGG-01163
恢复测试
rman 中遇到 ORA-01861
mysql和连接相关的timeout
MySQL大小写敏感说明
如何清除 DBA_DATAPUMP_JOBS 视图中的异常数据泵作业
字符乱码 导致 ORA-12899: value too large
Cannot return from outside a function or method.
关于MySQL字符集问题:Specified key was too long; max key length is 767 bytes
热门文章
Hive 性能调优
Hive 脚本执行
Hadoop部署记录
mac 上python编译报错No module named MySQLdb
让Mac支持lrzsz
一次永久解决cmd窗口汉字显示乱码
星型模型和雪花型模型比较
OLTP和OLAP的区别
Spark Shuffle原理、Shuffle操作问题解决和参数调优
Spark Streaming与Storm的对比及使用场景
Copyright © 2011-2022 走看看