Tuesday, September 24, 2013

Error executing child request for ChartImg.axd

While working working with MS Chart control in .net 3.5,i am getting following error :
"Error executing child request for ChartImg.axd " and it is solved by following steps:

Add in webconfig 

1.Add chart image saving folder name as
<appSettings>
 <add key="ChartImageHandler" value="storage=file;timeout=20;dir=C:\TempImageFiles\;" /></appSettings>

2. add http handler as:

<httpHandlers>
  <add path="ChartImg.axd" verb="GET,HEAD" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false" />
</httpHandlers>

3.Add Handler as

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


4.Make sure you need to add Chart Image save location(ImageLocation) tag in Chart control as:

 <asp:Chart ID="Chart2" runat="server"  Height="536px" Width="680px" ImageStorageMode="UseImageLocation" ImageLocation="TempImageFiles/ChartPic_#SEQ(300,3)" EnableViewState="true">
                        <Titles>
                        <asp:Title Name="Title1" Text="Enforceble Pie" 
                        Alignment="TopCenter" Font="Verdana, 12pt, style=Bold" ForeColor="Purple">
                        </asp:Title>
                        </Titles>
                        <Series>
                        <asp:Series Name="Series1" ChartType="Pie" CustomProperties="PieLabelStyle=outside, CollectedThresholdUsePercent=False, PieLineColor=Purple" Legend="Legend1"   >
                        </asp:Series>

                        </Series>
                        <Legends>
                        <asp:Legend Name="Legend1" BackImageAlignment="Bottom" Docking="Bottom" 
                                Font="Verdana, 7.25pt" IsTextAutoFit="False"  >
                        </asp:Legend>

                        </Legends>
                        <ChartAreas>
                        <asp:ChartArea Name="ChartArea1" >
                        </asp:ChartArea>
                        </ChartAreas>
                        </asp:Chart>
            












No comments:

Post a Comment