public ActionResult GetStatesByCountryId(string countryId) { if (String.IsNullOrEmpty(countryId)) { throw new ArgumentNullException("countryId"); } int id = 0; bool isValid = Int32.TryParse(countryId, out id); IList <State> states = _myRepo.GetAllStatesByCountryId(id); var result = (from s in states select new { id = s.Id, name = s.Name, tax = s.Tax.ToString() }).ToList(); return(Json(result, JsonRequestBehavior.AllowGet)); }