开发者

Problems rendering usercontrol with Charts to PDF

I am trying to render the context of an usercontrol to a PDF document. The usercontrol contains some charts (default asp.net charts):

// Getting the content from the usercontrol

myUsercontrol.Visible = true; StringBuilder content = new StringBuilder(); StringWriter tw = new StringWriter(content); HtmlTextWriter hw = new HtmlTextWriter(tw); myUsercontrol.RenderControl(hw); myUsercontrol.Visible = false;

// Generating the PDF

But sometimes I am getting an error with myUsercontrol.RenderControl(hw):

"error executing child request for chartimg.axd.".

I am not getting this error all the time. Sometimes it generates the PDF but then there is missing a chart (Missing image).

Anyone know what the problem could be and how to solve it?

Thanks very m开发者_开发百科uch in advance!


I found the problem, i have forgotten to add POST to the httphandler for the Chart in System.web in web.config. I had added it to the httphandler in Webserver but not in web and it was web I used for development :-)

<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜