0


I want to call server side C# function from javascript.

I used the way given in this article.

This works fine when I did the same steps in a new ASP.NET application.
But when I repeat the same steps in the application on which i am working it give the error:

"PageMethods is Undefined".

I am working on .Net 4.0.

1
  • 1
    You must have at least one page method in the page class in code behind. Having it in control won't work. Commented May 11, 2011 at 10:49

2 Answers 2

3

Have you enabled page methods on your scriptmanager?

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

Sign up to request clarification or add additional context in comments.

1 Comment

I did all the things that are given in the article, and its working in a new application. When i do that same in my old website, it doesn't work. I tried it in ascx and aspx both control and page.
2

Make sure you have a ScriptManager control?

As an alternative to trying to get the PageMethods approach to work, I would recommend switching to the more up to date WCF Script Services:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.