I started writing an ASP.NET Custom Server Control, where I wanted an Image to be Embedded Resource of the Assembly itself,
so that, I do not need to ship the images separately, but surprisingly it did not work straightway for me.
Solution:
After investigating a bit,
1. The resource URL in my code, (but still it did not work).
ibtnExcel.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(), ".Images.excel.png");
2. I investigated further and found that I did not explicitly declare the image as WebResource in my assembly info . To get the embedded resource bit working, the following line is very important, and this solved my problem.
Place below line of code in "Assembly.Info" file.
[assembly: System.Web.UI.WebResource("MyControls.images.ferrari.jpg", "image/jpg")]
Thursday, May 5, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment