how load images from Project - ImageURL s Are Stored In DataBase

edited April 2010 in FastReport .NET
hi my dear friends ...
i have many images stored in my Project in Images Folder...
i saved their URL in DataBase ....
one of those addresses is like : ~/Images/1.jpg

how can i tell PictureObject in my report to show these images (stored in my project)???
i do many ways and i test ImageLocation Property without any resaults....
plzz help me and tell me step by setp to solve this problem ...
i really like fast report and i do not want replace it bacause of this...
thanks for attention

Comments

  • edited April 2010
    Hello,

    You need to do the following:
    - in the WebReport.StartReport event, pass the physical path root to the report:
    WebReport1.Report.SetParameterValue("PathRoot", Server.MapPath(""));
    

    - in the report designer, select your Picture object and create BeforePrint event handler:
    string pathToPicture = (string)Report.GetDataColumn("YourTable.YourColumn");
    string pathRoot = (string)Report.GetParameterValue("PathRoot");
    Picture1.ImageLocation = pathRoot + pathToPicture.Remove(0, 1); // Remove is needed to remove ~ char
    

Leave a Comment