Attributes and WCF Web Service Load On Demand

3 posts, 0 answers
  1. Tim
    Tim avatar
    5 posts
    Member since:
    Aug 2011

    Posted 09 Aug 2011 Link to this post

    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. Tim
    Tim avatar
    5 posts
    Member since:
    Aug 2011

    Posted 10 Aug 2011 Link to this post

    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
  3. Nikolay Tsenkov
    Admin
    Nikolay Tsenkov avatar
    734 posts

    Posted 15 Aug 2011 Link to this post

    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.

Back to Top