Starting the project
| << Previous page | Next Page >> |
Start a new project by building a new Class Library
Resources
Add a new folder to the WITControlLibrary and name it Resources. Add the images needed for the control. In this example the images of the delete, edit, up and down button are added. The images are added to your project, but will not be a part of your control’s DLL. To embed the images into the DLL, select each image and change its property ‘Build Action’ to ‘Embedded Resource’.
AssemblyInfo.cs
The images will be embedded in the DLL when you build the project. But to be able to refer to the resources in the DLL-file from code-behind, you will need to add the resource to the AssemblyInfo.cs (Properties-directory). In case of the grid control, these rows will be added to the AssemblyInfo.cs:
//Resources
[assembly: System.Web.UI.WebResource("WITControlsLibrary.Resources.down.gif", "img/gif")]
[assembly: System.Web.UI.WebResource("WITControlsLibrary.Resources.up.gif", "img/gif")]
[assembly: System.Web.UI.WebResource("WITControlsLibrary.Resources.pencil.gif", "img/gif")]
[assembly: System.Web.UI.WebResource("WITControlsLibrary.Resources.delete.gif", "img/gif")]
|
If you copy the source from the web page, please be aware that the weblog changed the quotes into “smart quotes” which are interpreted differently by VS2005. In case you copy the code, find and replace not only the double quotes, but also the single quotes (which don’t cause an error). |
The WebResource contains the path to the resource, but use dots instead of slashes.
References
For the custom grid control, we need the following references:
System
Sytem.Data
System.Design
System.Web
System.Web.Extensions
System.Web.Extensions.Design
| << Previous page | Next Page >> |
aspknowledgebase said
The quotes in the source code are ’smart quotes’ which aren’t recognized by VS2005. When you copy the source code to VS2005 please replace the ’smart quotes’ by ’straight quotes’ in order to get it running.
Regards, Jan