asp.netasp.net-ajaxpagemethods

Pagemethods in asp.net


My Pagemethod implementation is not working in Chrome browser. I have ASP.NET 3.5 web application developed in VS 2008.

The code below not working in chrome or Safari:

function FetchDataOnTabChange(ucName)
{ 
    PageMethods.FetchData(ucName, OnSuccessFetchDataOnTabChange, OnErrorFetchDataOnTabChange);
}

function OnErrorFetchDataOnTabChange(error)
{   
   //Do something
}

function OnSuccessFetchDataOnTabChange(result)
{
   //Do something  
}

Solution

  • This should work in all browsers by following the steps below:

    This is from a working application

    aspx page:

    /* the script manager could also be in a master page with no issues */
    <asp:ScriptManager ID="smMain" runat="server" EnablePageMethods="true" />
    <script type="text/javascript">
        function GetDetails(Id) {
            PageMethods.GetDetails(doorId);
        }
    </script>
    

    code behind:

    [System.Web.Services.WebMethod]
    public static void GetDetails(string Id)
    {
    
    }