I think it may be a problem with your dictionary loading. I tried to set up a similar (but simpler) system for testing:
private class MyDict : Dictionary<int, string>
{
public override string ToString()
{
StringBuilder sb = new StringBuilder();
foreach( KeyValuePair<int, string> kvp in this)
{
sb.AppendFormat("MyDict {0}:{1}\n", kvp.Key, kvp.Value);
}
return sb.ToString();
}
}
private void button1_Click(object sender, EventArgs e)
{
Dictionary<int, MyDict> dict = new Dictionary<int, MyDict>();
dict.Add(0, NewDict(0));
dict.Add(1,NewDict(1));
dict.Add(2, NewDict(2));
foreach (int i in dict.Keys)
{
Console.WriteLine("{0} : {1}", i, dict[i]);
}
}
private MyDict NewDict(int i)
{
MyDict dict = new MyDict();
dict.Add(10, i.ToString() + "=zero");
dict.Add(1, i.ToString() + "=one");
dict.Add(2, i.ToString() + "=two");
return dict;
}
When I press the button, I get what I would expect:
0 : MyDict 0:0=zero
MyDict 1:0=one
MyDict 2:0=two
1 : MyDict 0:1=zero
MyDict 1:1=one
MyDict 2:1=two
2 : MyDict 0:2=zero
MyDict 1:2=one
MyDict 2:2=two
Have you check the data loaded is what you expect it to be?
[edit]Bloody HTML encode swallowing tags! Grumble, grumble... - OriginalGriff[/edit]