The server method 'LoadNodes' failed

7 posts, 1 answers
  1. Wouter
    Wouter avatar
    7 posts
    Member since:
    Apr 2011

    Posted 20 Apr 2011 Link to this post

    Hi,

    When I tried to expand my nodes in my RadTreeView I get the following error: 'The server method 'LoadNodes' failed'

    I've placed a RadTreeView on a UserControl, in the Page_Init the UserControl is initialized.
    Control control = LoadControl("/Pages/Controls/MenuControl.ascx");
    control.ID = "menuControl";
    panelMenu.Controls.Add(control);

    Now the RadTreeView is defined as following:
    <telerik:RadTreeView ID="radTOC" runat="server" Width="250px" Visible="false" CssClass="RadTreeView_RadSkins"
        EnableEmbeddedSkins="False" ShowLineImages="false" Style="white-space: normal;">
        <WebServiceSettings Path="../../Services/TreeViewService.asmx" Method="LoadNodes" />
    </telerik:RadTreeView>

    The treenodes are added to the RadTreeView as following:
    foreach (Publication sub in subPublications)
    {
       RadTreeNode treeNode = new RadTreeNode(sub.Name, sub.PublicationID.ToString());
       treeNode.ExpandMode = TreeNodeExpandMode.WebService;
       radTOC.Nodes.Add(treeNode);
    }

    The webmethod in TreeViewService.asmx:
    [System.Web.Script.Services.ScriptService]
    public class TreeViewService : System.Web.Services.WebService
    {
        [WebMethod]
        public static RadTreeNodeData[] LoadNodes(RadTreeNodeData node, object context)
        {
            List<RadTreeNodeData> result = new List<RadTreeNodeData>();
            RadTreeNodeData nodeData = new RadTreeNodeData();
            nodeData.Text = "Loaded on demand";
            nodeData.ExpandMode = TreeNodeExpandMode.WebService;
            result.Add(nodeData);
            return result.ToArray();
        }
    }

    Does anyone know what I'm doing wrong?

    Regards,
    Wouter splinter
  2. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 22 Apr 2011 Link to this post

    Hi Wouter,

    Could you, please, try using a tilde-noted relative path - my guess would be "~/Services/TreeViewService.asmx".


    Regards,
    Nikolay Tsenkov
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  3. Wouter
    Wouter avatar
    7 posts
    Member since:
    Apr 2011

    Posted 26 Apr 2011 Link to this post

    Thanks Nikolay,

    But the same error will appear again.

    Greetz,
    Wouter
  4. Helen
    Admin
    Helen avatar
    1052 posts

    Posted 29 Apr 2011 Link to this post

    Hello Wouter,

    Could you please try to determine the exact error message from the server? You can do so using Fiddler or Firebug to inspect the response to the Web Service requests.

    Thank you.

    Regards,
    Helen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  5. Wouter
    Wouter avatar
    7 posts
    Member since:
    Apr 2011

    Posted 29 Apr 2011 Link to this post

    Hi Helen,

    With fireBug I will get the following error: 500 Internal Server Error

    Server Error in '/' Application.

    Unknown web method LoadNodes.
    Parameter name: methodName

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.ArgumentException: Unknown web method LoadNodes.
    Parameter name: methodName

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Stack Trace:

    [ArgumentException: Unknown web method LoadNodes.
    Parameter name: methodName]
       System.Web.Script.Services.WebServiceData.GetMethodData(String methodName) +526258
       System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName) +10
       System.Web.Script.Services.RestHandler.CreateHandler(HttpContext context) +152
       System.Web.Script.Services.RestHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +62
       System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated) +47
       System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +203
       System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +128
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
    

     


    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

     




    I will hope you can solve this issue.

    Regards,
    Wouter
  6. Answer
    Helen
    Admin
    Helen avatar
    1052 posts

    Posted 03 May 2011 Link to this post

    Hi Wouter,

    Please remove the "static" declaration from the RadTreeNodeData[]  web method:

    http://stackoverflow.com/questions/1263379/why-are-static-methods-not-usable-as-web-service-operations-in-asmx-web-services

    Regards,
    Helen
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

  7. Wouter
    Wouter avatar
    7 posts
    Member since:
    Apr 2011

    Posted 03 May 2011 Link to this post

    Thank you Helen, this issue is solved!

    Regards
    Wouter
Back to Top