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

Web Service Context Error...

5 Answers 68 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
tom
Top achievements
Rank 1
tom asked on 14 Mar 2009, 10:12 PM
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.

5 Answers, 1 is accepted

Sort by
0
tom
Top achievements
Rank 1
answered on 19 Mar 2009, 03:46 AM
Can anybody help me with this?
How context is sent using svc? Any example?

Thanks, 
0
Veselin Vasilev
Telerik team
answered on 19 Mar 2009, 07:27 AM
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.
0
tom
Top achievements
Rank 1
answered on 19 Mar 2009, 07:33 AM
I folow the example, without linq, the context fails.
How to get the context without linq?

0
Atanas Korchev
Telerik team
answered on 20 Mar 2009, 01:08 PM
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.
0
tom
Top achievements
Rank 1
answered on 20 Mar 2009, 07:56 PM
Thanks for confirming this.
I can use asmx in the mean time.

Tags
TreeView
Asked by
tom
Top achievements
Rank 1
Answers by
tom
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Atanas Korchev
Telerik team
Share this question
or