Hi
Could someone help me with the ChartImagesPath property of the UltraChart control (NetAdvantage for ASP.NET 2008 Vol 2).
I've tried modifying the properties of the control from the code behind (e.g. UltraChart1.ChartImagesPath = @"c:\mydirectory"; or... Chart1.ChartImagesPath = "mydirectory";), from the aspx source and from the properties page of the control and every time the control just uses the default of "ChartImages" in the root of the application directory.
If I look at the path to the rendered chart image it always points to the "ChartImages" directory and if I rename this directory the application crashes out saying "Error: Sys.WebForms.PageRequestManagerSErverErrorException: Could not find a part of hte path 'c:\inetpub... ...\ChartImages". I wish to use the control in a SharePoint site using SmartPart therefore I need to specify a directory elswhere for ChartImages.
Thanks
Andy
Mourbare,
Thanks for the solution. I would note that MVC is not required for this to work. One final addition:
Chart.DeploymentScenario.ImageUrl = ResolveUrl("~/blabla/ChartImages/Chart_#SEQNUM(100).png");
I think this resolves the problem.
for People using asp.net mvc, you can set the Images path from the root of your server like this:
Chart.DeploymentScenario.Scenario = ImageDeploymentScenario.FileSystem;Chart.DeploymentScenario.FilePath = "/Content/ChartImages";Chart.DeploymentScenario.ImageURL = "/Content/ChartImages/Chart_#SEQNUM(100).png";
the issue with the tilde character (~) in the ImageURL was logged as bug # 20022 and fixed on 7/27. it will be resolved in an upcoming service release.
I tried both "~/ChartImages" and "../../../ChartImages" and it doesn't work. It does find the right directory and saves the file there but then renders the <img> tag with the "src" attribute pointing elsewhere. How do i resolve that?
PS. Until there is an answer, if anybody else has this problem, you can override RenderChildren() in your container (Page or UserControl) like this:
protected override void RenderChildren(HtmlTextWriter writer) { StringWriter sw = new StringWriter(); HtmlTextWriter hw = new HtmlTextWriter(sw); base.RenderChildren(hw); writer.Write(sw.ToString().Replace("src=\"ChartImages", string.Format("src=\"{0}", ResolveUrl("~/ChartImages")))); }
PPS. The above doesn't work with partial postbacks. Besides, string.Replace is slow. A better solution is to change the "src" attribute by locating the <img> tag using Javascript. Implementation of that differs depending on the framework that's in use.
Hi Greg,
I was having the same issue. The way I got it working was to use the design view of the ASPX page that the UltraWebChart was on and configure the DeploymentScenario in the Properties window. It was fairly straight-forward. The only real issue I had was using "~/" for "go up one directory" didn't work, so I used "../" instead. Here is what it looked like in code:
<DeploymentScenario FilePath="../images/temp/chart" ImageURL="../images/temp/chart/Chart_#SEQNUM(100).png" />
Hope that helps.
Peter
Lenos Software