Accepted answer

List is not serializable to web method instead of this you can return object[].

    public object[] getProgram12Months(string usersessionid)
        List<object> iData = new List<object>();
        List<string> labels = new List<string>();

        //First get distinct Month Name for select Year.
        string query1 = "SELECT DISTINCT TOP (100) PERCENT TimeFrame FROM dbo.CSQ_ProgramCount12Months ORDER BY TimeFrame ";

        string conn = ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString;
        SqlDataAdapter dap = new SqlDataAdapter(query1, conn);
        DataSet ds = new DataSet();
        DataTable dtLabels = ds.Tables[0];

        foreach (DataRow drow in dtLabels.Rows)

        return iData.ToArray();


I resolved this by creating two classes an populating them. Thank you er-sho, your posts help lead me in the right direction.

public class ChartData2
        public List<string> Legends;
        public List<int> AD;


    public class Legend
        public List<string> Months;

Related Query

More Query from same tag