Use the webresource attribute to implement self-contained resource files in controls

Source: Internet
Author: User

. NET 2.0Then, you can use the webresource attribute to write the server control to implement self-contained resource files in the control.

The procedure is as follows:

1. Use the webresource attribute to include the resource files required by the control to the control. resource files include: *. HTC, *. CSS, *. GIF, *. jpg, and so on.

Resource files are global variables and can be used by each control within the entire project assembly. Therefore, we can include the webresouce attribute in the assemblyinfo. VB file of the project.

2. Set the properties of the resource file and set the "generate operation" to "checked in resources" to generate the resource file to the DLL file during compilation.


3. Pay attention to the properties of the project where the control is located. If the project property does not specify the root namespace
Webresource only needs to be followed by the file name, for example: <Assembly: webresource ("projddtree. HTC", "text/X-component")>

If the project attribute specifies the root namespace, you must: <Assembly: webresource ("namespace. projddtree. HTC", "text/X-component")>

4. How to call resource files in controls



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.