We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cant run code from example

Thread ID:





127611 Nov 28,2016 02:38 PM UTC Nov 29,2016 10:22 AM UTC ASP.NET Web Forms 1
Tags: Chart
Asked On November 28, 2016 02:38 PM UTC

Hello. Cant simulate example from this link :https://help.syncfusion.com/aspnet/chart/getting-started#populate-chart-with-data
Part: populate chart with data.
Default.aspx code:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="aspnet._Default" %>

ASP.NET стартовый проект

ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript.

Getting started

ASP.NET Web Forms lets you build dynamic websites using a familiar drag-and-drop, event-driven model.
A design surface and hundreds of controls and components let you rapidly build sophisticated, powerful UI-driven sites with data access.

Get more libraries

NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.

Web Hosting

You can easily find a web hosting company that offers the right mix of features and price for your applications.


using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Syncfusion.XlsIO;
using System.Data.OleDb;
using System.IO;
using System.Drawing;
using System.Collections;
namespace aspnet
public partial class _Default : Page
protected void Page_Load(object sender, EventArgs e)
System.Collections.Generic.List data = new System.Collections.Generic.List();
data.Add(new ChartData("Jan", 35));
data.Add(new ChartData("Feb", 28));
data.Add(new ChartData("Mar", 34));
data.Add(new ChartData("Apr", 32));
data.Add(new ChartData("May", 40));
data.Add(new ChartData("Jun", 32));
data.Add(new ChartData("Jul", 35));
data.Add(new ChartData("Aug", 55));
data.Add(new ChartData("Sep", 38));
data.Add(new ChartData("Oct", 30));
data.Add(new ChartData("Nov", 25));
data.Add(new ChartData("Dec", 32));
this.Chart1.DataSource = data;
protected void Button1_Click(object sender, EventArgs e)
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets[0];
//Inserts the sample data for the chart
sheet.Range["A1"].Text = "Month";
sheet.Range["B1"].Text = "Product A";
sheet.Range["C1"].Text = "Product B";
sheet.Range["A2"].Text = "Jan";
sheet.Range["A3"].Text = "Feb";
sheet.Range["A4"].Text = "Mar";
sheet.Range["A5"].Text = "Apr";
sheet.Range["A6"].Text = "May";
//Create a random Data
Random r = new Random();
for (int i = 2; i <= 6; i++)
for (int j = 2; j <= 3; j++)
sheet.Range[i, j].Number = r.Next(0, 500);
IChartShape chart = sheet.Charts.Add();
//Set chart type
chart.ChartType = ExcelChartType.Line;
//Set Chart Title
chart.ChartTitle = "Product Sales comparison";
//Set first serie
IChartSerie productA = chart.Series.Add("ProductA");
productA.Values = sheet.Range["B2:B6"];
productA.CategoryLabels = sheet.Range["A2:A6"];
//Set second serie
IChartSerie productB = chart.Series.Add("ProductB");
productB.Values = sheet.Range["C2:C6"];
productB.CategoryLabels = sheet.Range["A2:A6"];
workbook.SaveAs("Output.xlsx", ExcelSaveType.SaveAsXLS, Response, ExcelDownloadType.PromptDialog);
public class ChartData
public string Month;
public double Sales;
public ChartData(string month, double sales)
this.Month = month;
this.Sales = sales;
ERROR text:
Необработанное исключение в строке 10, столбце 560730 в http://localhost:61203/ScriptResource.axd?d=Jkmno33bce4svznBZeQsJNGMIsEsK3CLu1kG5ing9z3PPf951PG6f01Jd6HHjaVlp4TJb4hVvHlfOuyNdwW9O6A39wWAwZNf1VFK9dmQKrhTkorJScYhN2ejAvJE82Y_ocubSyOJQQuvJgDR4MroHSx5OCeJkfmZ4Yj42mmRZwS6o8-cKaY4DryFwpb_5PPkJsXdFFRz9bHlJJstWHe6rcS20b4T5JKfzQtDkjj_27s1&t=ffffffffac27eb04
0x800a138f - JavaScript runtime error: Unable to get property '0' of undefined or null reference
Link to Error line:

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon