Web Service Context Error...

6 posts, 0 answers
  1. tom
    tom avatar
    19 posts
    Member since:
    Dec 2008

    Posted 14 Mar 2009 Link to this post

    I update to Telerik Q1 2009, also, change TreeView web service from asmx to svc.
    Here is the piece of code from Telerik Help:

    <script type="text/javascript">
       
    function nodePopulating(sender, eventArgs)
       {
           varnode = eventArgs.get_node();
           var context =eventArgs.get_context();
           context["CategoryID"] =node.get_value();
       }
    </script>

       [OperationContract]
       
    publicRadTreeNodeData[] GetTreeViewCategories(RadTreeNodeDatanode, object context)
       {
           
    // extract the"context" dictionary information. OnClientNodePopulating event loads thedictionary
           
    IDictionary<string, object> contextDictionary =(IDictionary<string,object>)context;
    ....
       }

    I get the error:

    System.InvalidCastException was unhandled by user code
      Message="Unable to cast object of type 'System.Object' to type 'System.Collections.Generic.IDictionary`2[System.String,System.Object]'."
      Source="App_Code.3vtfiouj"
    ....

    How do I fix it?

    Thanks.
  2. tom
    tom avatar
    19 posts
    Member since:
    Dec 2008

    Posted 18 Mar 2009 Link to this post

    Can anybody help me with this?
    How context is sent using svc? Any example?

    Thanks, 
  3. Veselin Vasilev
    Admin
    Veselin Vasilev avatar
    2992 posts

    Posted 19 Mar 2009 Link to this post

    Hi tom,

    Please check this online example:
    Load on Demand > WCF Web Service

    Greetings,
    Veselin Vasilev
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  4. tom
    tom avatar
    19 posts
    Member since:
    Dec 2008

    Posted 19 Mar 2009 Link to this post

    I folow the example, without linq, the context fails.
    How to get the context without linq?

  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Mar 2009 Link to this post

    Hi tom,

    We confirm that the context property is not correctly populated during WCF load on demand. We will do our best to resolve that issue in the upcoming service pack. Let us know if this is urgent for you.

    Regards,
    Albert
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. tom
    tom avatar
    19 posts
    Member since:
    Dec 2008

    Posted 20 Mar 2009 Link to this post

    Thanks for confirming this.
    I can use asmx in the mean time.

Back to Top