protected void panelonload(object sender, EventArgs e) { try { var sc = new RecipeServiceSoapClient(); List<MongoMap> mn = new List<MongoMap>(); //Response.Write(sc.Search("mango")); mn = JsonConvert.DeserializeObject<List<MongoMap>>(sc.DataAnalytics()); // String ca = null, data; Dictionary<String,Double> dic=new Dictionary<string, Double>(); foreach (var map in mn) { dic.Add(map._id,map.value.count); //Response.Write(map._id+"-"+map.value.count+"<br/>"); if (map.value.count > 100) { // ca += map._id.Replace("PT", "") + ","; BarChartSeries a = new BarChartSeries(); a.Name = map._id.Replace("PT", ""); a.BarColor = GenerateRandomColour().ToString(); a.Data = new[] { Convert.ToDecimal(map.value.count) }; BarChart1.Series.Add(a); } GridView2.DataSource = dic; GridView2.DataBind(); } // BarChart1.CategoriesAxis = ca.Substring(0, ca.Count() - 1); } catch (Exception ex) { Response.Write(ex); } }