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
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
Please remember to mark the appropriate replies as answer after your question is solved, thanks
Immigrant bi...
Member
445 Points
281 Posts
showing image
Apr 22, 2011 01:07 PM|LINK
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
<div class="mcePaste" id="_mcePaste" style="position: absolute; width: 1px; height: 1px; overflow: hidden; top: 0px; left: -10000px;"></div>akhhttar
Contributor
6506 Points
963 Posts
Re: showing image
Apr 23, 2011 11:49 AM|LINK
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
My Blog
Immigrant bi...
Member
445 Points
281 Posts
Re: showing image
Apr 23, 2011 06:45 PM|LINK
Hi my friend,
I changed the path to the following but it does not work:
GetImageLocation= "/happy.jpg"
please help me?
akhhttar
Contributor
6506 Points
963 Posts
Re: showing image
Apr 24, 2011 07:25 AM|LINK
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
My Blog
Immigrant bi...
Member
445 Points
281 Posts
Re: showing image
Apr 24, 2011 02:15 PM|LINK
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
Immigrant bi...
Member
445 Points
281 Posts
Re: showing image
Apr 26, 2011 05:33 PM|LINK
Hi again ,
I uploaded my project with its relevent sql server file in the following link:
http://immigrantbird.com/MainReport.rar
Please help me?
Immigrant bi...
Member
445 Points
281 Posts
Re: showing image
May 01, 2011 07:13 PM|LINK
nobody there????????????????????????????????????????????????
akhhttar
Contributor
6506 Points
963 Posts
Re: showing image
May 01, 2011 07:51 PM|LINK
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
My Blog
Immigrant bi...
Member
445 Points
281 Posts
Re: showing image
May 02, 2011 05:21 PM|LINK
Thanks my friend I hope so ????????????????????????
Immigrant bi...
Member
445 Points
281 Posts
Re: showing image
May 14, 2011 06:17 AM|LINK
Nobody can help????????????????????????????????????????????????????????????????????????????????