Hi All
I have the following web method , no success on return a correct Json format.
[System.Web.Services.WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json,
UseHttpGet = true, XmlSerializeString = false)]
public static List<object> GetAllCompany()
{
Entities.Interface.Account.ICompanyRepository svc = new DAL.Account.CompanyRepository();
return svc.GetAll().Select(p => new { p.CompanyName, p.ID }).ToList<object>();
}
GetAll() return list of type "Company" POCO classes.
The web method complaint type "Company" could not cast to object. However I could not just return the Company type because client side Json only accept its 2 properties -"CompanyName", "ID" and I want to k ...
Go to the complete details ...