Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have this Dictionary in C#.
C#
Dictionary<string, string[]>


I serialized the string and now I want to get all the keys in javascript and show an alert message with the key and also load value into a var StringArrayItems
I have this in jscript

var dictionary = eval( "(" + dict + ")" );

And now I want something like this
JavaScript
for(var s in dictionary)
{
alert(s);
var strings = s.value;
}
Posted
Comments
krumia 15-Jun-12 23:27pm    
Your question is not clear. Please expand.

1 solution

Why not use AJAX (XMLHttpRequest) and get the string formed directly from server in your Javascript? I am not too sure that we can traverse through a Dictionary item in Javascript as you want to. AJAX approach would be simple and easy. Try it!

AFAIK, This is the closest thing to what you want via Dictionary way: Javascript Dictionary[^] - sample uses .NET code but is quite simple to understand.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900