views:

19

answers:

1

Hi all,

When I try to access web method I obtain error:

PageMethods.GetRate is not a function;

My method:

    [WebMethod]
    [ScriptMethod]
    public static string GetRate(string date)
    {
        return "qwe123";
    }

Register assembly:

    <%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="aspajax" %>

Script manager:

    <aspajax:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />

Javascript:

<script type="text/javascript">
    function OnGetRateComplete(result)
    {
        alert(result);
    }

    $(function() { $( "#<%=dtSignDate.ClientID %>" ).datepicker({ onSelect: function(date) { PageMethods.GetRate(date, OnGetRateComplete); }}); });
</script>

GetRate method is visible in generated page source.

What is wrong?

A: 

Did you make sure you applied the ScriptService attribute to your web service? i.e.

[ScriptService]
public class WebService : System.Web.Services.WebService
Keith
This is page, not web service.
Dumitru