PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

ASP.NET 2.0, Images and resources

 
 
schneider@rehm.de
Guest
Posts: n/a
 
      2nd Feb 2007
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

 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      2nd Feb 2007
you are setting the image url to image content rather than the image.
use ClientScript.GetWebResourceUrl() to calc the url.

-- bruce (sqlwork.com)

(E-Mail Removed) wrote:
> 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
>

 
Reply With Quote
 
schneider@rehm.de
Guest
Posts: n/a
 
      28th Mar 2007
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


On 2 Feb., 20:28, bruce barker <nos...@nospam.com> wrote:
> you are setting theimageurl toimagecontent rather than theimage.
> use ClientScript.GetWebResourceUrl() to calc the url.
>
> -- bruce (sqlwork.com)
>
> schnei...@rehm.de wrote:
> > Hi all,

>
> > I'm facing some problems using images from resources.
> > I have aresourcefile "MyResources.resx" in the App_GlobalResources
> > folder. It contains a stringresource(here: "TheAlternateText" for
> > the corresponding ImageButton-property) and animageresource
> > ("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
> > theimageis not displayed.
> > Using a localresourceand meta:resourcekey="ImageButton1" produces
> > the same results.
> > Any ideas what I'm doing wrong?
> > Thanks in advance.

>
> > Cheers,
> > Hannes



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Resources (images) loading time Keven Corazza Microsoft Dot NET Compact Framework 2 28th Jan 2010 06:33 AM
How can I access images in the Resources folder? Cooz Microsoft VB .NET 6 3rd Sep 2009 08:52 AM
How to work with images in resources WT Microsoft ASP .NET 5 18th May 2006 06:38 AM
Using images as embedded resources =?Utf-8?B?UG9udGlNYXg=?= Microsoft ASP .NET 0 3rd Feb 2005 10:43 AM
Suggested Resources for Beginners: Using Images E. T. Culling Microsoft Frontpage 0 10th Nov 2003 01:43 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:22 AM.