ASP.NET 2.0, Images and resources

  • Thread starter Thread starter schneider
  • Start date Start date
S

schneider

Hi all,

I'm facing some problems using images from resources.
I have a resource file "MyResources.resx" in the App_GlobalResources
folder. It contains a string resource (here: "TheAlternateText" for
the corresponding ImageButton-property) and an image resource
("TheImage") which should be displayed on the ImageButton.
Now I add AlternateText="<%$ Resource: MyResources, TheAlternateText
%>" and ImageUrl="<%$ MyResources, TheImage %>" to the asp:ImageButton-
Tag.
When I run the page, the alternate text is displayed correctly, but
the image is not displayed.
Using a local resource and meta:resourcekey="ImageButton1" produces
the same results.
Any ideas what I'm doing wrong?
Thanks in advance.

Cheers,
Hannes
 
you are setting the image url to image content rather than the image.
use ClientScript.GetWebResourceUrl() to calc the url.

-- bruce (sqlwork.com)
 
Could you please post some sample code? I don't get it to work.
I have a web page Default.aspx. I created the App_LocalResource folder
in this directory. There, I created a resource file Default.aspx.resx
to which I added an image. Now I want the image to be displayed by an
<asp:Image /> control in Default.aspx. What do I have to do? I tried

string url = Page.ClientScript.GetWebResourceUrl(my_img.GetType(),
"the_img");
my_img.ImageUrl = url;

but it doesn't work. I'm sure my fault is a trivial one, but I'm
actually going nuts. ASP.NET Version is 2.0.

Cheers, Hannes
 
Back
Top