This is a migrated thread and some comments may be shown as answers.

RadScriptManager, MasterPages - PageMethods is Undefined

1 Answer 328 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Brian Garson
Top achievements
Rank 2
Brian Garson asked on 17 Sep 2009, 08:37 PM
Hello,

I'm trying to implement an extra toolbar button in my RadEditor that will call my codebehind via a Page Method and submit some content.  We're using Master Pages and I have my RadScriptManager on the master page:

<telerik:RadScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true" />

for my RadEditor in my ASCX user control I have:
<telerik:EditorTool Name="SaveDesign" Text="SAVE" ShowText="true" ShowIcon="false" />

and further down:

<script type="text/javascript"
Telerik.Web.UI.Editor.CommandList["SaveDesign"] = function(commandName, editor, args) 
   PageMethods.MySave("input string",CallSuccess,CallFail); 
}; 
 
function CallSuccess(results, userContext, methodName) 
 alert(results); 
function CallFail(errors, userContext, methodName) 
 alert(errors.get_Message()); 
</script> 
 

and in my codebehind I have:

[System.Web.Services.WebMethod()] 
        public static string SaveShit(string stuff) 
        { 
            return "did something"
        } 


When I browse the page and click the toolbar button I get the error:

Error: 'PageMethods' is undefined

I'm kind of stuck with this, any help would be appreciated.

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 23 Sep 2009, 08:22 AM
Hi Brian,

Instead of

PageMethods.MySave("input string",CallSuccess,CallFail);

you should fire

PageMethods.SaveShit("input string",CallSuccess,CallFail);

If this does not help please implement your scenario with a standard input button using the information provided in these sites. If the code works with a standard button then it will work with a custom RadEditor's button:

http://msdn.microsoft.com/en-us/magazine/cc163393.aspx

http://footheory.com/blogs/bennie/archive/2006/12/01/exposing-asp-net-page-methods-as-ajax-web-services.aspx

http://forums.asp.net/p/993893/1296227.aspx

http://chiragrdarji.wordpress.com/2008/10/22/page-methods-is-undefined/

http://www.west-wind.com/weblog/posts/152493.aspx

http://www.ironspeed.com/Designer/4.2.2/WebHelp/Part_VI/PageMethods_is_undefined.htm


Best regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Ajax
Asked by
Brian Garson
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Share this question
or