Bob Burns
09-14-2004, 07:32 PM
Hi,
I am trying to store the values in a hashtable I create in my code when the page was initially loaded. The code looks something like this
Dim hashtable New As System.Collections.Hashtable
If Not IsPostBack Then
hashtable.Add(key, value)
Else
method_that_uses_hashtable()
End If
The hashtable is declared in the general declaractions section so it should be an issue of variable scope. But when I attempt to use the hashtables.keys() methods which returns a collection of keys as an icollection object I get an error when the page is posted back saying the variable hashtable refers to non-existent object. Is there anyway I could save this hashtable after the page is posted back? I have read about Session or View object that could be used to save variable states between post back which one would be ideal for my application?
Thanks Bob.
I am trying to store the values in a hashtable I create in my code when the page was initially loaded. The code looks something like this
Dim hashtable New As System.Collections.Hashtable
If Not IsPostBack Then
hashtable.Add(key, value)
Else
method_that_uses_hashtable()
End If
The hashtable is declared in the general declaractions section so it should be an issue of variable scope. But when I attempt to use the hashtables.keys() methods which returns a collection of keys as an icollection object I get an error when the page is posted back saying the variable hashtable refers to non-existent object. Is there anyway I could save this hashtable after the page is posted back? I have read about Session or View object that could be used to save variable states between post back which one would be ideal for my application?
Thanks Bob.