This is a migrated thread and some comments may be shown as answers.

inserting a image?

13 Answers 2280 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
NightFlash
Top achievements
Rank 1
NightFlash asked on 18 Jun 2007, 11:00 AM
Hi,

I'm trying to insert a image (into the header) of the reporting. First I tried with the picturebox but that didn't work, after that I tried like the example using style >> background image. And I have almost the same error. My image is just a jpg in the folder "images".

System.Resources.MissingManifestResourceException was unhandled by user code
  Message="Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure \"VerhuurRapport.resources\" was correctly embedded or linked into assembly \"App_Code.29im1eh8\" at compile time, or that all the satellite assemblies required are loadable and fully signed."

I have the last version of the reporting, I hope you guys can help me!

Greetz,
Kevin
 

13 Answers, 1 is accepted

Sort by
0
NightFlash
Top achievements
Rank 1
answered on 18 Jun 2007, 11:05 AM
it's this line that he has problems with:

this.pageHeader.Style.BackgroundImage.ImageData = ((System.Drawing.Image)(resources.GetObject("pageHeader.Style.BackgroundImage.ImageData")));

Can't you just easy say "images/logo.jpg" ?

0
Svetoslav
Telerik team
answered on 18 Jun 2007, 04:07 PM
Hi NightFlash,

The line of code with the problem takes an embedded image to display it as the BackgroundImage.

From your 1st post it seems that your reports reside in a Web Site project. This type of project has specific requirements for embedded resources. First off your resources should be placed in any of the two special Web Site folders - App_GlobalResources or App_LocalResources. According to the resource location you should use either the HttpContext.GetGlobalResourceObject() or HttpContext.GetLocalResourceObject().

The code you're using uses the System.Resources.ResourceManager object that is not applicable when working in a Web Site.

The Web Site project has a lot of peculiarities and restrictions, and because of this we strongly recommend our clients to separate the reports in a Class Library project, or to use the Web Application project (you need to install the Visual Studio 2005 SP1).
 

Best wishes,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
NightFlash
Top achievements
Rank 1
answered on 19 Jun 2007, 10:56 AM
Thanks for the help, indeed the Website had troubles reading the report. I did exactly the same in an apart class library and it all worked fine.

1 last question maybe, is there somewhere an overview where I can see all the functions you can use in a report. By example =SUM(prices)
Like that I can see what I can do special with the reports!

Thnx again!
0
Svetoslav
Telerik team
answered on 19 Jun 2007, 03:16 PM
Hi NightFlash,

You can learn more about the item binding expressions in our documentation that comes with the Telerik Reporting installation. The topic in question can also be found online here.
 

Sincerely yours,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
rh
Top achievements
Rank 1
answered on 24 Aug 2007, 11:06 PM
In a class library, do you have to use the resource manager to programatically set the image? Or can you use the Value property and, if so, what would you set the value property to (e.g. "=images/myimage.gif" if in an images folder in the class library)?
0
rh
Top achievements
Rank 1
answered on 26 Aug 2007, 11:55 PM
I figured it out. I added a resource file, added an image to the resource file, and then in the databound event in my report all I have to do is use myPictureBox.ImageData = MyResourceFile.MyPicName. Short and sweet. :)
0
Svetoslav
Telerik team
answered on 27 Aug 2007, 01:21 PM
Hi rh,

It's good that you've managed to overcome the PictureBox troubles. I just want to describe in brief the PictureBox data binding.

Usually at design time you use the Telerik.Reporting.PictureBox.Value property to specify the data for the item. The event is of type System.Object it accepts objects of only 2 specific types:
  • System.String - interpreted as item binding expression that should evaluate to System.Drawing.Image or byte[], that will be used internally as Image data;
  • System.Drawing.Image - the Image to be rendered.

On the other hand at runtime you can use the ReportItemBase.ItemDataBound event that occurs after the item is bound. As far as the PictureBox item is concerned the PictureBox.Value is evaluated and the you can obtain the result through the corresponding processing item - Telerik.Reporting.Processing.PictureBox.ImageData.

When you need to use static images (not from the data source) you can use all the different approaches that the .NET Framework offers to load them:

  • with System.Drawing.Image.FromFile() you can to load an image from a file
  • with System.Drawing.Image.FromStream you can load the image from a data stream;
  • you can use the System.Resources.ResourceManager class to use your embedded resource
  • you can use the System.Drawing.Bitmap(Type, string) constructor that again loads image from the resources

Sincerely yours,

Svetoslav

the Telerik team


Instantly find answers to your questions at the new Telerik Support Center
0
Sankar
Top achievements
Rank 1
answered on 01 Apr 2008, 12:10 PM
Hi,
       I came forward with the same error, where I didn't use a separate Class Library structure and I am new to Asp.Net , I heared from the below quote that "Web Site project has a lot of peculiarities and restrictions" .May I know what are they , which may help me to move forward.

thanks,
Sankar
0
Svetoslav
Telerik team
answered on 02 Apr 2008, 07:43 AM
Hi Sankar,

The Web Site project in Visual Studio 2005 enables the developments of ASP.NET web sites easily handling the most common tasks automatically. For example you are no more required to compile the project before running it; the classes inside the App_Code where the reports should reside are not treated as designable components; For more information please see Visual Web Developer.

Unfortunately, this automatic behavior prevents the report designer from performing correctly some of its basic operations. The workaround that we strongly suggest is just to avoid developing your reports inside the Web Site; you can use the Web Application project or put the reports in a class library project and then reference it from the Web Site exactly as we have done in our sample solutions. If you still have not got the chance to examine them (in both C# and VB.NET) you will find very useful information there.

All the best,
Svetoslav
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sankar
Top achievements
Rank 1
answered on 02 Apr 2008, 12:41 PM
Hi,
 thanks,  itz cool ...... i  have an query, is the same in visual studio 2008
 or we can generate report in  website (VS 2008).......What is that resources and can some give ideas about website folders App_GlobalResources or App_LocalResources
0
Vassil Petev
Telerik team
answered on 03 Apr 2008, 09:13 AM
Hi Sankar,

The web site project behavior is similar in both Visual Studio 2005 and 2008 so our prescriptions are valid in both cases.

Regarding the two resource folders - these are special application folders where the Web Site expects its resources. For more information on the Web Site layout, the two folders in question, or any other general ASP.NET question please refer to MSDN.

 
Sincerely yours,
Vassil
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Sankar
Top achievements
Rank 1
answered on 03 Apr 2008, 09:39 AM
hi vassil,
thanks,

0
Filipe Peixinho
Top achievements
Rank 1
answered on 27 Nov 2009, 10:10 AM
Hi!

Why not start using the Rad Binary Image component in Telerik Reporting? It would be very usefull.
Tags
General Discussions
Asked by
NightFlash
Top achievements
Rank 1
Answers by
NightFlash
Top achievements
Rank 1
Svetoslav
Telerik team
rh
Top achievements
Rank 1
Sankar
Top achievements
Rank 1
Vassil Petev
Telerik team
Filipe Peixinho
Top achievements
Rank 1
Share this question
or