locked
showing image RRS feed

  • Question

  • User-9833593 posted

    Hello everyone ,

    I have the following code to show image in a report but it does not woke and more intrestingly it works in vs 2005 but now in vs 2010 it does not work

    =Code.GetImageLocation(Fields!Amount.Value, Fields!Cost.Value)

     I have the code above in expression of image and I have the following code in the code section of report property

    Public Shared Function GetImageLocation(ByVal Amount AS Double, ByVal Cost AS Double) AS String
           DIM tmpProfitLoss AS Double
           DIM tmpProfitPercentage AS Double
      
          'calculate profit/loss and determine percentage of profit ratio
           tmpProfitLoss = Amount - Cost
           tmpProfitPercentage = (tmpProfitLoss / Amount) * 100
    
           'check for loss first, then more then 10%
           If tmpProfitLoss < 0
    	GetImageLocation= "C:\Users\stranger\Desktop\reporting\comeseeme.jpg"
           Else If tmpProfitLoss > 25
    	GetImageLocation= "C:\Users\stranger\Desktop\reporting\happy.jpg" 
           Else
    	GetImageLocation= "C:\Users\stranger\Desktop\reporting\sad.jpg"
           End If
    End Function
    
    

     

     

    
    Friday, April 22, 2011 9:07 AM

Answers

  • User2105670541 posted

    why dont you try the full path instead of below line:

    GetImageLocation="./happy.jpg"

    write down the full path as

    GetImageLocation=http://localhost/yoursite/happy.jpg

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 24, 2011 3:25 AM

All replies

  • User1483970546 posted

    Hi,

    I think you have to give Virtual file path ( not physical path). Place the images inside the web site directory and then use virtual path.

    e.g. If images are placed inside Images/reporting folder under website then, you can use following paths

    "/images/reporting/happy.jpg"

    Thanks

    -Akhtar

     

     

    Saturday, April 23, 2011 7:49 AM
  • User-9833593 posted

    Hi my friend,

    I changed the path to the following but it does not work:

    GetImageLocation= "/happy.jpg"

    please help me?

    Saturday, April 23, 2011 2:45 PM
  • User1483970546 posted

    Hi,

    This code mean that happy.jpg is placed in website root directory. Is it the vailid path.

    Can you please post the code where you are assigning the path to image contro. Also let me know the physical location sof website and images.

    Thanks

    -Akhtar

    Sunday, April 24, 2011 3:25 AM
  • User-9833593 posted

    Hi,

    yes this is in the root dirctory and the physical path is:C:\Users\stranger\Desktop\reporting

    and the physical path of image:C:\Users\stranger\Desktop\reporting\happy.jpg

     

    Sunday, April 24, 2011 10:15 AM
  • User-9833593 posted

    Hi again ,

    I uploaded my project with its relevent sql server file in the following link:

    http://immigrantbird.com/MainReport.rar

    Please help me?

    Tuesday, April 26, 2011 1:33 PM
  • User-9833593 posted

    nobody there????????????????????????????????????????????????

    Sunday, May 1, 2011 3:13 PM
  • User1483970546 posted

    Hi,

    I downloaded the code but I was not able to run it because of some database issues ( I think you are using SQL Server 2008 db while I had SQL Server 2005). I found that you are using image in report but I don't have experience working with asp.net reports that's why I can't really suggest what to do to show the image.

    I am sure it will not be very difficult to fix the issue, hopefully someone else on this forum can help you.

    Thanks

    -Akhtar

    Sunday, May 1, 2011 3:51 PM
  • User-9833593 posted

    Thanks my friend I hope so ????????????????????????

    Monday, May 2, 2011 1:21 PM
  • User-9833593 posted

    Nobody can help????????????????????????????????????????????????????????????????????????????????

    Saturday, May 14, 2011 2:17 AM
  • User2105670541 posted

    i think you need to create avirtual path, just like you create in IIS to create any virtual directory.

    for example, lets suppose you have a location D:/images and inside images you have many images, so you can create a virtual directory refering to this path, and at runtime dynamically or static, you can show your images with the image type in SSRS

    Tuesday, May 17, 2011 1:26 PM
  • User-9833593 posted

    Hi my friend,

    I tested the virtual path too but it does not work

    Friday, May 20, 2011 6:00 AM
  • User2105670541 posted

    Hello,

    please make sure you're following steps below:

    • create a virtual directory in your IIS and provide the directory of your image folder.
    • add a image control in your SSRS report from toolbox
    • set the image properties>> General >>
    • select the image source= External
    • set the image path in Use the Image box, you can either provide the path or if you are retrieving image path from DB then pass the expression.

     

    Hope it will help :)

    Friday, May 20, 2011 3:44 PM
  • User-9833593 posted

    Hi my friend,

    I followed the steps and this is my project you can download it and if it is possible please check it then let me know.If you solve this problem you would help me a lot...

    Monday, May 23, 2011 7:49 AM
  • User2105670541 posted

    upload your project so that we can try to find out the solution Pal :)

    Monday, May 23, 2011 10:14 AM
  • User-9833593 posted

    Sorry I forgot to write the link ,

    you can download it from the following link

    http://immigrantbird.com/MainReport.rar

    Thanks a lot beforehand

     

    Monday, May 23, 2011 1:45 PM
  • User2105670541 posted

    why dont you try the full path instead of below line:

    GetImageLocation="./happy.jpg"

    write down the full path as

    GetImageLocation=http://localhost/yoursite/happy.jpg

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, May 24, 2011 3:25 AM
  • User-9833593 posted

    My friend you are awesome I am so happy because my problem solved after long time

    Hope the best for you

    Tuesday, May 24, 2011 11:08 AM
  • User2105670541 posted

    thanks Pal.....i'm happy that i helped.... thank Microsoft :)

    Tuesday, May 24, 2011 12:11 PM