locked
Line Chart RRS feed

  • Question

  • User1999497519 posted

    I can't get the ajax line chart to render in the browser. 

    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <asp:LineChart ID="LineChart1" runat="server" ChartHeight="250" ChartTitle="Chart Title" ChartWidth="400" CategoriesAxis="1,2,3,4,5,6">
                <Series>
                    <asp:LineChartSeries Data="3,7,2,7,5,1" LineColor="Blue" Name="Series#1" />
                </Series>
            </asp:LineChart>

    Friday, April 11, 2014 12:29 PM

Answers

  • User281315223 posted

    Assuming you are using the AJAX Control Toolkit have you properly registered the toolkit either in your page or through the web.config :

    <pages>
          <namespaces>
            <add namespace="System.Web.Optimization" />
          </namespaces>
          <controls>
            <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" />
            <!-- Example -->
            <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
          </controls>
    </pages>

    You'll also need to make sure that you are using the ScriptManager from the Toolkit and not just a basic ScriptManager as seen below :

    <ajaxToolkit:ToolkitScriptManager runat="Server" />
    <ajaxToolkit:LineChart ID="LineChart1" runat="server" ChartHeight="250" ChartTitle="Chart Title" ChartWidth="400" CategoriesAxis="1,2,3,4,5,6">
                <Series>
                    <ajaxToolkit:LineChartSeries Data="3,7,2,7,5,1" LineColor="Blue" Name="Series#1" />
                </Series>
    </ajaxToolkit:LineChart>

    which in your case since you are using the "asp" tag for the Toolkit as well, might look like :

    <asp:ToolkitScriptManager runat="Server" />
    <asp:LineChart ID="LineChart1" runat="server" ChartHeight="250" ChartTitle="Chart Title" ChartWidth="400" CategoriesAxis="1,2,3,4,5,6">
                <Series>
                    <asp:LineChartSeries Data="3,7,2,7,5,1" LineColor="Blue" Name="Series#1" />
                </Series>
    </asp:LineChart>

    I used your same code and simply added the AjaxControlToolkit through NuGet and my page loaded and appeared as follows :

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 11, 2014 1:09 PM