As I review some older code, I can only assume that it worked at some point in time.
MyPage.aspx:
function GetCompanyList(officeId) {
var companyList = document.getElementById('<%= CompanyDropDown.ClientID %>');
if (companyList.length == 0)
PageMethods.GetCompanyList(officeId, OnGetCompanyList);
else
EditCompany();
}
Also:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />
Code behind:
[System.Web.Services.WebMethod()]
[System.Web.Script.Services.ScriptMethod()]
public IEnumerable<CompanyMinimum> GetCompanyList(int officeId) {
return (
from c in Repository.Query<Company>()
where !c.IsDeleted && c.TypeEnumIndex == (short)CompanyRelationshipType.Hotel
select new CompanyMinimum() {
id = c.Id,
desc = c.Description
}
).ToList();
}
However, when the PageMethods.GetCompanyList()
is called in the first code snippet, Chrome now shows an error:
PageMethods is not defined
Is there anyone who can identify what has changed causing this functionality to no longer work?
Note: I have seen similar inquiries, but they mostly pertain to this code not functioning within master pages or user controls, which is not the scenario here.