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

Attributes and WCF Web Service Load On Demand

2 Answers 52 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 09 Aug 2011, 11:58 PM
On the server side, I've built a RadTreeView whose nodes have attributes.

RadTreeView tree = new RadTreeview();
tree.ID = "MyRadTree";
tree.WebServiceSettings.Path = "MyServices.svc";
tree.WebServiceSettings.Method = "GetNodes"
...
RadTreeNode nodes = new RadTreeNode();
...
RadTreeNode expandNode1 = new RadTreeNode();
expandNode1.Text = "Apples";
expandNode1.Value = "1";
expandNode1.Attributes.Add("NodeType", "Fruit");
expandNode1.ExpandNode = TreeNodeExpandNode.WebService;
...
tree.Nodes.AddRange(nodes);

My service, GetNodes(), is called, but the node.Attributes count is 0.

[OperationContract]
public RadTreeNodeData[] GetNodes(RadTreeNodeData node, IDictionary<string, object> context)
{
   string value = node.Value; // ok
   string text = node.Text; // ok
   int attributeCount = node.Attributes.Count; // 0
   string attribute = node.Attributes["NodeType"]; // Exception "The given key was not present in the dictionary"
}

Is this supposed to work?  Any ideas what I could be missing?  Might I need to add a [WebInvoke ...] attribute to my web method, perhaps changing the method style?

(Note that the attribute(s) are available from the client side; they just don't seem to make it through to the web service.)

Thanks.

2 Answers, 1 is accepted

Sort by
0
Tim
Top achievements
Rank 1
answered on 10 Aug 2011, 02:19 PM
Oh, I see. We're supposed to pass parameters to the web service through the "context" dictionary. But even though I seem to be populating it in OnClientNodePopulating, as explained in the online example, it still doesn't work.  The context remains empty.  Is this bug?

UPDATE: Hmmm... just found this 2-year-old thread.  Was this issue ever addressed?  If so, what version?

http://www.telerik.com/community/forums/aspnet-ajax/treeview/web-service-context-error.aspx
0
Nikolay Tsenkov
Telerik team
answered on 15 Aug 2011, 02:58 PM
Hi Tim,

I have tested the scenario and it still reproduces with latest version.
I am going to log it and schedule it for fixing.

Please, accept our sincere apologies for the caused inconvenience.

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.

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