Page Methods return undefined javascript error

F

Fresno Bob

I have a web method in my page, with Page Methods enabled on
ScriptManager. When I call the function to get a return value my alert box
says undefined. It works if I define a OnSuccess function in JS for my
method. I want to get a return value and feed it to another JS function. I am
quite happy for the calls to be synchronous as one JS function needs a
function from a previous one. This is VS 2008 SP 1 and .net 3.5

<WebMethod()> _
Public Shared Function MyMethod(ByVal name As String) As String
Return "Hello " & name
End Function


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



window.onload = function() {

alert(PageMethods.MyMethod("Paul Hayman"));

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,739
Latest member
Clint8040

Latest Threads

Top