I am trying to call a page method in javascript to update a textbox with a value. The result of any method I write is always the entire markup for the page. Has anyone seen this before?
I am using master pages. The script manager has EnablePageMethods set to true. Is there something else I need to do?
jamarchist
Member
7 Points
2 Posts
Page Method Returns Whole Page
May 17, 2007 04:35 PM|LINK
I am trying to call a page method in javascript to update a textbox with a value. The result of any method I write is always the entire markup for the page. Has anyone seen this before?
I am using master pages. The script manager has EnablePageMethods set to true. Is there something else I need to do?
ajax asp.net ajax ajax callback
jdiamond
Member
165 Points
36 Posts
Re: Page Method Returns Whole Page
May 19, 2007 02:28 AM|LINK
Is the method public, static, and attributed with [WebMethod]?
groker
Member
42 Points
22 Posts
Re: Page Method Returns Whole Page
Sep 06, 2007 07:46 PM|LINK
I'm having the same problem, and yes to your question....
Codebehind
[
WebMethod]public static string test()
{
return "Hello World!!";
}
Javascript
function test()
function OnComplete(result, userContext, methodName){
PageMethods.test(OnComplete, OnComplete, null)
}
{
alert(result);
}
SafeAddOnload(test);
Any ideas?
Thanks
groker
Member
42 Points
22 Posts
Fix: Page Method Returns Whole Page
Sep 06, 2007 08:33 PM|LINK
Boy do I feel stupid.... if you have the same problem, try adding the following under <httpModules> in the config.web
<
add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>