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. Image for the cookie policy date

Can't get data binding to work.

I am trying to use the data binding per the help file in Chart/Working with data but it isn't working.
I get this error message. 
Error 20 System.Collections.Generic.List`1[[Syncfusion.JavaScript.DataVisualization.Models.Series, Syncfusion.EJ, Version=13.3450.0.7, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89]] must have items of type 'Syncfusion.JavaScript.DataVisualization.Models.Series'. 'ej.Series' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'.

 Below is my code:

ASPX file;
<ej:Chart ID="Chart1" runat="server" Width="485" Height="300" CanResize="true" OnClientSeriesRendering="seriesRender" 
        Depth="100" WallSize="2" Tilt="0" Rotation="34" PerspectiveAngle="90" EnableRotation="true" Enable3D="true">
           <CommonSeriesOptions Type="Column" />

                <ej.Series Name="2012" XName="Xvalue" YName="YValue1"></ej.Series>
CS code in page load;

            SqlCommand command = DataAccess.GetSqlCommand(ref connection, commandText);

            command.CommandType = CommandType.Text;

            SqlDataAdapter adapter = DataAccess.GetSqlDataAdapter(ref command);

            DataSet data = new DataSet();
            int i = 0;


            List<ChartData> chartData = new List<ChartData>();

            for (i = 0; i <= data.Tables[0].Rows.Count - 1; i++)

                chartData.Add(new ChartData("IAPD 2012",(decimal)data.Tables[0].Rows[i].ItemArray[0]));
                chartData.Add(new ChartData("IAPD 2013",(decimal)data.Tables[0].Rows[i].ItemArray[1]));
                chartData.Add(new ChartData("IAPD 2014",(decimal)data.Tables[0].Rows[i].ItemArray[2]));
                chartData.Add(new ChartData("IAPD 2015",(decimal)data.Tables[0].Rows[i].ItemArray[3]));
                chartData.Add(new ChartData("IAPD 2016",(decimal)data.Tables[0].Rows[i].ItemArray[4]));
                chartData.Add(new ChartData("IAPD 2017",(decimal)data.Tables[0].Rows[i].ItemArray[5]));
                chartData.Add(new ChartData("IAPD 2018",(decimal)data.Tables[0].Rows[i].ItemArray[6]));
                chartData.Add(new ChartData("IAPD 2019",(decimal)data.Tables[0].Rows[i].ItemArray[7]));

            for (i = 0; i <= chartData.Count - 1; i++)
                Debug.WriteLine(chartData[i].Xvalue + " - $" + chartData[i].YValue1);


            this.Chart1.DataSource = chartData;
        catch (Exception ex)
            Debug.WriteLine("An error occured! " + ex.Message);

public class ChartData
        public ChartData(string xval, decimal yvalue1)
            this.Xvalue = xval;
            this.YValue1 = yvalue1;

        public string Xvalue

        public decimal YValue1
    } // end class ChartData

3 Replies

SK Sanjith Kesavan Syncfusion Team November 11, 2015 07:26 AM UTC

Hi James Butler,

Thanks for contacting Syncfusion support. We have analyzed your query and used the code example provided by you in our sample. We can able to reproduce the exact issue mentioned by you. While analyzing your code we found that inside the series tag you have used <ej.Series> for defining the series. Instead of that please use <ej:Series> for defining the series. Please find the following code example


In the above code example we have done the suggested modification. Now the chart is rendering correctly.

We have modified the sample as per your requirement. Please find the sample from below mentioned location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/121100/ze/Databinding2040171717


Please let us know if you have any concern.


Sanjith K.

JB James Butler November 16, 2015 04:16 PM UTC

Thanks, I guess all I needed was an extra pair of eyes that could see the problem.
Those little things are the ones that really get you.

SK Sanjith Kesavan Syncfusion Team November 17, 2015 08:57 AM UTC

Hi James Butler,


We are glad that your issue has been resolved. Feel free to contact us any time if you face any other issues.



Sanjith K.

Live Chat Icon For mobile
Up arrow icon