liaqat ali
liaqat ali

Reputation: 241

calling serverside method from javascript


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.

Upvotes: 0

Views: 702

Answers (2)

Tom Robinson
Tom Robinson

Reputation: 8508

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:

Upvotes: 2

Johnno Nolan
Johnno Nolan

Reputation: 29659

Have you enabled page methods on your scriptmanager?

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

Upvotes: 3

Related Questions