You must Sign In to post a response.
  • Category: Webservices

    Pagemethods are not defined

    hi all

    i am trying to call server side method on client side

    but i am getting error as "uncaught reference error:pagemethods are not defined"

    my code is

    <asp:LinkButton ID="ibtncommonzoom" runat="server" class="mdi-action-find-in-page" Width="25%" Height="25%" OnClientClick="ibtncommonzoom_Click()" ></asp:LinkButton>

    <script type="text/javascript">

    function ibtncommonzoom_Click()
    var queryID = document.getElementById('<%=Label1.ClientID %>').innerText;
    var name = ddlcommon.options[ddlcommon.selectedIndex].value;
    var area = null;
    var no = null;
    if (name != "0") {
    PageMethods.zoomlayers(queryID, name, area, no);
    return false;


    [ScriptMethod, WebMethod]

    public void zoomlayers(string queryID, string name, string area, string no)


  • #763601
    You have to use the "static"

    You can try the following.

    public static string zoomlayers(string queryID, string name, string area, string no)



    By Nathan
    Direction is important than speed

  • #763605
    use static methods with WebMethod and call it using jQuery Ajax method

    [ScriptMethod, WebMethod]
    public static void zoomlayers(string queryID, string name, string area, string no)



    for more info


  • #763610
    if you using 'ajaxToolkit' then you need to set 'EnablePageMethods' to 'true', see below markup
    <ajaxToolkit:ToolkitScriptManager ID="scriptManager"
    EnablePageMethods="true" />

    additionally Page Methods don't work in either Master Pages or User Controls. If you move the method up one level to you page it should work.

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #763676
    Hai Rishe,
    It seems you have forgotten to make the EnablePageMethods to true for the ScriptManager.
    You can check at the below link for more details:

    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

Sign In to post your comments