score:0

The solution it simple. You have forgotten to import the highcharts.js and ajax libraries.

    <asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
    <section class="featured">
        <div class="content-wrapper">
            <hgroup class="title">
                <h1><%: Title %>.</h1>
                <h2>Testing HighCharts with ASP.NET</h2>
            </hgroup>
        </div>
    </section>
</asp:Content>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <h3>This should show a chart:</h3>

  <!-- IMPORT THE JAVASCRIPT LIBRARIES HERE -->
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  <script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>
  <script type="text/javascript" src="http://code.highcharts.com/modules/exporting.js"></script>

  <asp:Literal id="ltChart1" runat="server"></asp:Literal>
</asp:Content>

score:2

If you are using Site.Master file to add path of the JavaScript files, then make sure you have added path of these three JavaScript files.

    <asp:ScriptManager runat="server">
        <Scripts>               
            <asp:ScriptReference Path="~/Scripts/highcharts.js" />
            <asp:ScriptReference Path="~/Scripts/jquery-1.5.1.min.js" />   
            <asp:ScriptReference Path="~/Scripts/exporting.js" />              
        </Scripts>
    </asp:ScriptManager>

Check out this tutorial: http://dotnethighcharts.codeplex.com/ Here it is explained for both MVC and Web Forms.


Related Articles