inserting a image?

14 posts, 0 answers
  1. NightFlash
    NightFlash avatar
    50 posts
    Member since:
    Mar 2007

    Posted 18 Jun 2007 Link to this post

    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
     
  2. NightFlash
    NightFlash avatar
    50 posts
    Member since:
    Mar 2007

    Posted 18 Jun 2007 Link to this post

    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" ?

  3. DevCraft banner
  4. Svetoslav
    Admin
    Svetoslav avatar
    649 posts

    Posted 18 Jun 2007 Link to this post

    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
  5. NightFlash
    NightFlash avatar
    50 posts
    Member since:
    Mar 2007

    Posted 19 Jun 2007 Link to this post

    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!
  6. Svetoslav
    Admin
    Svetoslav avatar
    649 posts

    Posted 19 Jun 2007 Link to this post

    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
  7. rh
    rh avatar
    193 posts
    Member since:
    Jan 2007

    Posted 24 Aug 2007 Link to this post

    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)?
  8. rh
    rh avatar
    193 posts
    Member since:
    Jan 2007

    Posted 26 Aug 2007 Link to this post

    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. :)
  9. Svetoslav
    Admin
    Svetoslav avatar
    649 posts

    Posted 27 Aug 2007 Link to this post

    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
  10. Sankar
    Sankar avatar
    5 posts
    Member since:
    Apr 2008

    Posted 01 Apr 2008 Link to this post

    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
  11. Svetoslav
    Admin
    Svetoslav avatar
    649 posts

    Posted 02 Apr 2008 Link to this post

    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
  12. Sankar
    Sankar avatar
    5 posts
    Member since:
    Apr 2008

    Posted 02 Apr 2008 Link to this post

    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
  13. Vassil Petev
    Admin
    Vassil Petev avatar
    1765 posts

    Posted 03 Apr 2008 Link to this post

    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
  14. Sankar
    Sankar avatar
    5 posts
    Member since:
    Apr 2008

    Posted 03 Apr 2008 Link to this post

    hi vassil,
    thanks,

  15. Filipe Peixinho
    Filipe Peixinho avatar
    41 posts
    Member since:
    May 2006

    Posted 27 Nov 2009 Link to this post

    Hi!

    Why not start using the Rad Binary Image component in Telerik Reporting? It would be very usefull.
Back to Top
DevCraft banner