public void getAllSelectedCategories(string phone, string clientID) { try { string json1 = "";//list of all categories string json2 = "";//list of categories selected by user int storeID = GetStoreIDbyPhone(phone); DataTable dtAllCategories = new DataTable(); MySQLBusinessLogic bl = new MySQLBusinessLogic(); dtAllCategories = bl.GetOtherCategories(); if (dtAllCategories.Rows.Count > 0) json1 = ConvertDataTabletoString(dtAllCategories); List<string> lstSelected = new List<string>(); lstSelected = bl.GetOtherCategoriesbyStoreID(storeID); var jsonSerialiser = new JavaScriptSerializer(); json2 = jsonSerialiser.Serialize(lstSelected); Clients.Client(clientID).gotAllCatAndSelectedCat(json1, json2); } catch (Exception ex) { } }