All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
C++封装与访问控制[二.二]
个人站长网站的发展将是一条漫长的道路_JavaScript技术_编程技术
Visual,Studio,2005集成开发环境图解(一)_[Asp.Net教程]
apache的几个设置(目录,权限等)_[PHP教程]
visual c++中树视图控件(Tree Control)
精通数据库系列之入门-基础篇2_mssql学习_编程技术
Asp.Net发送电子邮件程序_[Asp.Net教程]
SQL,server,2005安装问题汇总_mssql学习_编程技术
MIS开发中.net,Framework的打印功能_[Asp.Net教程]
在ASP.NET,Atlas中调用Web,Service_[Asp.Net教程]
Reading number is top 10 pictures
福利福利。。。。。。
China's first snake village2
Exquisite decoration is not paying too much2
The real super beauty2
Street street fighting
囚犯暴乱了咋办?
29 the belle stars after bath figure2
职场回春术
奇趣的世界记录3
到南昌西站了3
Download software ranking
SP4 for SQL2000
Unix video tutorial5
I'm come from Beijing2
Unix video tutorial19
White deer villiage
The king of fighters 97(Mobile phone games-apk)
Such love down(擒爱记)
Unix video tutorial7
Jinling thirteen stock
The Bermuda triangle3
delv published in(发表于) 2014/1/6 9:01:13 Edit(编辑)
ASP.NET2.0,WebRource,开发微调按钮控件_[Asp.Net教程]

ASP.NET2.0,WebRource,开发微调按钮控件_[Asp.Net教程]

ASP.NET2.0 WebRource,开发微调按钮控件_[Asp.Net教程]























现在。有许多开发人员已经在使用ASP.NET2.0的WebResource的功能了。WebResource允许我们嵌入资源到程序集中。包括图像,文本等。




在介绍WebResource就不得不介绍一下WebResource.axd,我们来看一下




script language="javascript" src="WebResource.axd?a=s&r=WebUIValidation.js&t=631944362841472848" type="text/javascript">目前我发现webResource.axd的参数跟现在版本有属不同。在早期文章介绍属性:
a 程序集名称
r 资源文件名称
t 程序集最后修改的时间





webResource.axd只是ISAPI中的一个映射。你也可以在使用IhttpHandler。 webResource.axd是通过AssemblyResourceLoader类来自定义处理HTTP请求,根据所query传递的程序来识别从哪个程序集中获取哪个资源。




下面以微调控件为示例。




使用步骤:
添加要嵌入的资源(比如图像)到项中
在资源管理器中,单击文件,在property window(属性窗口)中build action选择embedded resource(嵌入资源)。
添加下列文件到你的assessbly.cs文件哪中
[assembly: WebResource("Obies.Web.UI.WebControls.NumericTextBox.js", "application/x-javascript")]
[assembly: WebResource("Obies.Web.UI.WebControls.NumericTextBox_Silver_BtnUp.gif", "image/gif")]请注意WebResourceAttribute格式:
[assembly: WebResourceAttribute("MyNameSpaces.Resources.MyImage.gif", "image/gif")]
在CONTROL源码当中。你需要使用下面代码来获取图像
// get WebResource URLs for the embedded gif images
String BtnUpImgSrc = this.Page.ClientScript.GetWebResourceUrl(typeof(NumericTextBox),
"Obies.Web.UI.WebControls.NumericTextBox_" + this.ImageSet.ToString() + "_BtnUp.gif");GetWebResourceUrl method:Gets a URL reference to a server-side resource.(获取对服务器端资源的 URL 引用)
我发现在早期版本当中。它的使用方法是:this.page.GetWebResourceUrl




上面代码是从指定的程序集中当中获取图像名称:Obies.Web.UI.WebControls.NumericTextBox_" + this.ImageSet.ToString() + "_BtnUp.gif,它返回的是一个服务器端资源的URL引用地址。类似于:
WebResource.axd?d=gWYJBlnQKynoTePlJ34jxyoSpR2Rh9lpYd8ZrSl0&t=632812333820000000




另外,MS提供一个Header类。Header类主要是对HTML页面中的的操作。包括Title等
呵呵。以后要修改一个页面的标题很很简单了。
this.Header.Title = "This is the new page title.";
添加CSS样式(style attribute) Style style = new Style();
style.ForeColor = System.Drawing.Color.Navy;
style.BackColor = System.Drawing.Color.LightGray;




// Add the style to the header for the body of the page
this.Header.StyleSheet.CreateStyleRule(style, null, "body");




protected override void OnPreRender (EventArgs e) {
// get a WebResource URL for the core JS script and register it
this.Page.ClientScript.RegisterClientScriptResource(typeof(NumericTextBox),
"Obies.Web.UI.WebControls.NumericTextBox.js");
// get a WebResource URL for the embedded CSS
String css = this.Page.ClientScript.GetWebResourceUrl (typeof(NumericTextBox),
"Obies.Web.UI.WebControls.NumericTextBox_" + this.ImageSet + ".css");
// register the CSS
// this.Page.StyleSheetTheme = css;
//this.Page.Header.LinkedStyleSheets.Add (css);
//早期版本的方法?只能用下面的代码来解决了
HtmlLink link = new HtmlLink();
link.Attributes.Add("type", "text/css");
link.Attributes.Add("rel", "stylesheet");
link.Attributes.Add("href", css);
this.Page.Header.Controls.Add(link);




}
下面是微调控件的截图




使用方法:
<%@ register tagprefix="cc" namespace="Obies.Web.UI.WebControls" assembly="Obies.Web.UI.WebControls" %>




maxvalue="10" minvalue="0">
maxvalue="10" minvalue="0">




来源地址:http://msdn.microsoft.com/library/default.asp?url=/library/en-us/
dnvs05/html/webresource.asp
由于原来的代码有点问题,很多特性都是最新VS2005不支持的。所以进行了修改。
源码下载:http://www.cnblogs.com/Files/cnzc/PostWebFormBetweenFrames.zip




在写这篇文章查了很多资料。也尝试用心去写。但总感觉写的不是很好。网上也有相关的webresource的介绍。但发现很多都是目前最新版本不支持的。不知道是不是以前ASP.NET2.0早期版本。所以才进行了简单的修改。
以后在努力了。




来源:网络












































添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.