public string TelephoneList(string type, string PupilID) { Users PupilClass = new Users(); string PupilClassCode = PupilClass.GetPupilOtClass(PupilID); TelphoneList TL = new TelphoneList(); DataTable DT = TL.FilterTelphoneListForMobile(type, PupilClassCode); var list = new List <Dictionary <string, object> >(); foreach (DataRow row in DT.Rows) { var dict = new Dictionary <string, object>(); foreach (DataColumn col in DT.Columns) { dict[col.ColumnName] = row[col]; } list.Add(dict); } JavaScriptSerializer js = new JavaScriptSerializer(); string jsonStringTelephoneList = js.Serialize(list); return(jsonStringTelephoneList); }
protected void TLBTN_Click(object sender, EventArgs e) { string UserTypeFilter = FilterNotes.SelectedValue; Dictionary <string, string> List = new Dictionary <string, string>(); List = (Dictionary <string, string>)(Session["ClassesList"]); string ClassFilter = KeyByValue(List, ChooseClassDLL.SelectedValue);; TelphoneList TL = new TelphoneList(); GridView1.DataSource = TL.FilterTelphoneList(UserTypeFilter, ClassFilter); GridView1.DataBind(); }