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

Image URL setting from config file

6 Answers 149 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Manoj
Top achievements
Rank 1
Manoj asked on 28 Feb 2012, 09:23 PM
I am setting image URL as follows.
pictureBox1.Value = System.Configuration.ConfigurationSettings.AppSettings["ImageFolderURL"] + "apple_ex.png";
It is working fine when I am running application. I am able to see image in browser. If I am trying to preview report through designer Tab, It is saying "The given key was not present in the dictionary."
My Appsetting section:
<appSettings>
    <add key="ImageFolderURL" value="http://www.queness.com/resources/images/png/" />
  </appSettings>
Please suggest how I can make working in preview mode too.

6 Answers, 1 is accepted

Sort by
0
Squall
Top achievements
Rank 1
answered on 05 Mar 2012, 10:04 AM
Hi,
When you are previewing report in report designer the used configuration file is the one in the class library where you keep the reports.
Try to add the app settings configuration in the class library app.config. 
SN
0
Manoj
Top achievements
Rank 1
answered on 06 Mar 2012, 10:32 PM
appSettings are also included in app.config.
0
Accepted
Steve
Telerik team
answered on 07 Mar 2012, 10:47 AM
Hello Manoj,

Squall is right that when previewing the report, the configuration file used is not the one in your application, however it is not the app.config of the class library either. As described in MSDN, the ConfigurationManager.AppSettings Property gets the  AppSettingsSection data for the current application's default configuration.
In the case of report designer/preview the current application is devenv.exe so reading the  ConfigurationManager.AppSettings from the report that is previewed will get all app settings defined in the devenv.exe.config file.

Kind regards,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
Manoj
Top achievements
Rank 1
answered on 09 Mar 2012, 07:17 PM
Then, how is it reading connection string from appsettings without defining in devenv.exe.config .
0
Steve
Telerik team
answered on 12 Mar 2012, 10:04 AM
Hello Manoj,

We apply special logic to our data source components, so they read/write from the app.config of the class library in design time.

All the best,
Steve
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
Manoj
Top achievements
Rank 1
answered on 12 Mar 2012, 06:20 PM
Oh, I got it. Thanks.
Tags
General Discussions
Asked by
Manoj
Top achievements
Rank 1
Answers by
Squall
Top achievements
Rank 1
Manoj
Top achievements
Rank 1
Steve
Telerik team
Share this question
or