public static List <Data> GetData() { BL_StudentProfile objBL_StudentProfile = new BL_StudentProfile(); ML_StudentProfile objML_StudentProfile = new ML_StudentProfile(); DataTable dt = new DataTable(); objML_StudentProfile.ID = HttpContext.Current.Session["User_Code"].ToString(); dt = objBL_StudentProfile.BL_BindStudentScoreBoard(objML_StudentProfile); List <Data> dataList = new List <Data>(); string cat = ""; int val = 0; foreach (DataRow dr in dt.Rows) { cat = dr[0].ToString(); val = Convert.ToInt32(dr[1]); dataList.Add(new Data(cat, val)); } return(dataList); }