score:2

Accepted answer

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

[webmethod]
    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();
        dap.fill(ds);
        datatable dtlabels = ds.tables[0];


        foreach (datarow drow in dtlabels.rows)
        {
            labels.add(drow["timeframe"].tostring());
        }
        idata.add(labels.toarray());

        return idata.toarray();
    }

score:2

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