RadChart with .NET MVC

I have a webform app that I converted to a webform/mvc hybrid. Everything was fine until I tested the Telerik RadCharts on the existing webform pages. It had worked before the conversion. Now whenever the chart was supposed to load, I was confronted with this error message:

Error loading RadChart image. You may also wish to check the ASP.NET Trace for further details. Display stack trace?

Clicking “OK” simply took me to a 404 page. I did notice the url of this was http://localhost:11239/reports/ChartImage.axd?UseSession=true&ChartID=139df24e-1578-44d3-988b-c66f2d7df98c_chart_ctl00$MainContent$ReportChart1&imageFormat=Png&random=0.725656411482793

Somehow MVC routing disrupted the RadChart handler. To fix this, you need to explicitly define the HttpHanderUrl property of the RadChart.

ReportChart1.HttpHandlerUrl = ResolveUrl("~/ChartImage.axd");

That should fix it!

Leave a comment