ASP.NET2.0 WebRource, developing spinner control
Now. Many developers are already using the WebResource functionality of ASP.NET 2.0. WebResource allows us to embed resources into assemblies. Includes images, text, etc.
When introducing WebResource, we have to introduce WebResource.axd. Let’s take a look.
script language="javascript" src="WebResource.axd?a=s&r=WebUIValidation.js&t=631944362841472848 " type="text/javascript">Currently I found that the parameters of webResource.axd are different from the current version. In an earlier article, attributes were introduced:
a Assembly name
r Resource file name
t Assembly last modified time
webResource.axd is just one in ISAPI mapping. You can also use IhttpHandler.
The following uses the fine-tuning control as an example.
Usage steps:
Add the resources to be embedded (such as images) to the item
In the resource manager, click the file, select embedded resource in the build action in the property window (property window) (embedded resource).
Add the following files to your assessbly.cs file
[assembly: WebResource("Obies.Web.UI.WebControls.NumericTextBox.js", "application/x-javascript")]
[ assembly: WebResource("Obies.Web.UI.WebControls.NumericTextBox_Silver_BtnUp.gif", "image/gif")] Please note the WebResourceAttribute format:
[assembly: WebResourceAttribute("MyNameSpaces.Resources.MyImage.gif", "image /gif")]
is in the CONTROL source code. You need to use the following code to get the images
// 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.(Gets a URL reference to a server-side resource)
I found that in in earlier versions. Its usage is: this.page.GetWebResourceUrl
The above code gets the image name from the specified assembly: Obies.Web.UI.WebControls.NumericTextBox_" + this.ImageSet.ToString() + "_BtnUp.gif, which returns the URL reference address of a server-side resource. Similar to:
WebResource.axd?d=gWYJBlnQKynoTePlJ34jxyoSpR2Rh9lpYd8ZrSl0&t=632812333820000000
In addition, MS provides a Header class. The Header class mainly operates on
in HTML pages. Including Title etc.Haha. It will be very easy to modify the title of a page in the future.
this.Header.Title = "This is the new page title.";
Add CSS style (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" %>
来源地址: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早期版本。所以才进行了简单的修改。
以后在努力了。
The above is the detailed content of ASP.NET2.0 WebRource, developing spinner control. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











C#.NET interview questions and answers include basic knowledge, core concepts, and advanced usage. 1) Basic knowledge: C# is an object-oriented language developed by Microsoft and is mainly used in the .NET framework. 2) Core concepts: Delegation and events allow dynamic binding methods, and LINQ provides powerful query functions. 3) Advanced usage: Asynchronous programming improves responsiveness, and expression trees are used for dynamic code construction.

C# is a modern, object-oriented programming language developed by Microsoft and as part of the .NET framework. 1.C# supports object-oriented programming (OOP), including encapsulation, inheritance and polymorphism. 2. Asynchronous programming in C# is implemented through async and await keywords to improve application responsiveness. 3. Use LINQ to process data collections concisely. 4. Common errors include null reference exceptions and index out-of-range exceptions. Debugging skills include using a debugger and exception handling. 5. Performance optimization includes using StringBuilder and avoiding unnecessary packing and unboxing.

Testing strategies for C#.NET applications include unit testing, integration testing, and end-to-end testing. 1. Unit testing ensures that the minimum unit of the code works independently, using the MSTest, NUnit or xUnit framework. 2. Integrated tests verify the functions of multiple units combined, commonly used simulated data and external services. 3. End-to-end testing simulates the user's complete operation process, and Selenium is usually used for automated testing.

C#.NETisversatileforbothwebanddesktopdevelopment.1)Forweb,useASP.NETfordynamicapplications.2)Fordesktop,employWindowsFormsorWPFforrichinterfaces.3)UseXamarinforcross-platformdevelopment,enablingcodesharingacrossWindows,macOS,Linux,andmobiledevices.

C#.NET is still important because it provides powerful tools and libraries that support multiple application development. 1) C# combines .NET framework to make development efficient and convenient. 2) C#'s type safety and garbage collection mechanism enhance its advantages. 3) .NET provides a cross-platform running environment and rich APIs, improving development flexibility.

Interview with C# senior developer requires mastering core knowledge such as asynchronous programming, LINQ, and internal working principles of .NET frameworks. 1. Asynchronous programming simplifies operations through async and await to improve application responsiveness. 2.LINQ operates data in SQL style and pay attention to performance. 3. The CLR of the NET framework manages memory, and garbage collection needs to be used with caution.

C#.NETissuitableforenterprise-levelapplicationswithintheMicrosoftecosystemduetoitsstrongtyping,richlibraries,androbustperformance.However,itmaynotbeidealforcross-platformdevelopmentorwhenrawspeediscritical,wherelanguageslikeRustorGomightbepreferable.

C# is widely used in enterprise-level applications, game development, mobile applications and web development. 1) In enterprise-level applications, C# is often used for ASP.NETCore to develop WebAPI. 2) In game development, C# is combined with the Unity engine to realize role control and other functions. 3) C# supports polymorphism and asynchronous programming to improve code flexibility and application performance.
