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

The server method 'LoadNodes' failed

6 Answers 138 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Wouter
Top achievements
Rank 1
Wouter asked on 20 Apr 2011, 12:16 PM
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

6 Answers, 1 is accepted

Sort by
0
Nikolay Tsenkov
Telerik team
answered on 22 Apr 2011, 04:04 PM
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.

0
Wouter
Top achievements
Rank 1
answered on 26 Apr 2011, 12:20 PM
Thanks Nikolay,

But the same error will appear again.

Greetz,
Wouter
0
Helen
Telerik team
answered on 29 Apr 2011, 12:03 PM
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.

0
Wouter
Top achievements
Rank 1
answered on 29 Apr 2011, 12:23 PM

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
0
Accepted
Helen
Telerik team
answered on 03 May 2011, 10:49 AM
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.

0
Wouter
Top achievements
Rank 1
answered on 03 May 2011, 10:54 AM
Thank you Helen, this issue is solved!

Regards
Wouter
Tags
TreeView
Asked by
Wouter
Top achievements
Rank 1
Answers by
Nikolay Tsenkov
Telerik team
Wouter
Top achievements
Rank 1
Helen
Telerik team
Share this question
or