Click here to Skip to main content
15,910,787 members
Home / Discussions / C#
   

C#

 
AnswerRe: Prevent double-click to resize window Pin
PIEBALDconsult30-Jun-08 5:06
mvePIEBALDconsult30-Jun-08 5:06 
Questionopen a PDF document with C# Pin
laziale30-Jun-08 2:40
laziale30-Jun-08 2:40 
AnswerRe: open a PDF document with C# Pin
Simon P Stevens30-Jun-08 3:00
Simon P Stevens30-Jun-08 3:00 
AnswerRe: open a PDF document with C# Pin
leppie30-Jun-08 3:13
leppie30-Jun-08 3:13 
GeneralRe: open a PDF document with C# Pin
laziale30-Jun-08 3:25
laziale30-Jun-08 3:25 
GeneralRe: open a PDF document with C# Pin
laziale30-Jun-08 3:39
laziale30-Jun-08 3:39 
AnswerRe: open a PDF document with C# Pin
Thomas Stockwell30-Jun-08 4:49
professionalThomas Stockwell30-Jun-08 4:49 
Questionstoring and retrieving values from a hashtable stored in a session Pin
Member 340288630-Jun-08 2:26
Member 340288630-Jun-08 2:26 
Hi

I recently posted a question on ArrayList and although I would still like an answer, I have decided to use the Hashtable class instead of a 2-dim array. Anyway, I have created a small test example and am able to successfully store and retrieve values. However, I tried storing the hashtable in a session and then retrieving it but get an error on retrieving (so assume it has stored it as no error on that line). My timeout is 2000 so I'm sure that is not the problem. Anyway, here is my code:

protected void Button1_Click(object sender, EventArgs e)
{
Hashtable myHash = new Hashtable();

myHash.Add(TextBox1.Text, TextBox2.Text);

//store the hash table in a session object
Session["BooksOrdered"] = myHash;

//retrieve the details from the session object
Hashtable booksOrderedHash = new Hashtable();

booksOrderedHash = Session["BooksOrdered"];

// Loop over the list, writing out the value
foreach (DictionaryEntry myEntry in booksOrderedHash)
{
Response.Write(myEntry.Value);
}
}

The error is:

Cannot implicitly convert type 'object' to 'System.Collections.Hashtable'. An explicit conversion exists (are you missing a cast?)
Line: booksOrderedHash = Session["BooksOrdered"];

Any help would be greatly appreciated as I've spent since 10am this morning on this Frown | :(
AnswerRe: storing and retrieving values from a hashtable stored in a session Pin
Harvey Saayman30-Jun-08 3:19
Harvey Saayman30-Jun-08 3:19 
GeneralRe: storing and retrieving values from a hashtable stored in a session Pin
Simon P Stevens30-Jun-08 3:23
Simon P Stevens30-Jun-08 3:23 
GeneralRe: storing and retrieving values from a hashtable stored in a session Pin
Harvey Saayman30-Jun-08 3:26
Harvey Saayman30-Jun-08 3:26 
GeneralRe: storing and retrieving values from a hashtable stored in a session Pin
Member 340288630-Jun-08 23:51
Member 340288630-Jun-08 23:51 
AnswerRe: storing and retrieving values from a hashtable stored in a session Pin
Simon P Stevens30-Jun-08 3:22
Simon P Stevens30-Jun-08 3:22 
QuestionDisplay Images of different Sizes in ListView Pin
Pallavikris230-Jun-08 2:16
Pallavikris230-Jun-08 2:16 
QuestionHow to find the right item in listView control ? Pin
Yanshof30-Jun-08 2:14
Yanshof30-Jun-08 2:14 
QuestionAdding SQLCE to Distribution App Pin
Jammer30-Jun-08 1:59
Jammer30-Jun-08 1:59 
AnswerRe: Adding SQLCE to Distribution App Pin
Jammer30-Jun-08 9:20
Jammer30-Jun-08 9:20 
Questionresolving a distribution list in order to send emails Pin
randprin30-Jun-08 1:54
randprin30-Jun-08 1:54 
QuestionArrayList - multi-dimensional and Dynamic Pin
Member 340288630-Jun-08 1:24
Member 340288630-Jun-08 1:24 
AnswerRe: ArrayList - multi-dimensional and Dynamic Pin
DaveyM6930-Jun-08 1:36
professionalDaveyM6930-Jun-08 1:36 
GeneralRe: ArrayList - multi-dimensional and Dynamic Pin
Member 340288630-Jun-08 2:33
Member 340288630-Jun-08 2:33 
GeneralRe: ArrayList - multi-dimensional and Dynamic Pin
DaveyM6930-Jun-08 2:48
professionalDaveyM6930-Jun-08 2:48 
AnswerRe: ArrayList - multi-dimensional and Dynamic [modified] Pin
GuyThiebaut30-Jun-08 5:40
professionalGuyThiebaut30-Jun-08 5:40 
Questionavoid duplicates in list Pin
cst_kvp30-Jun-08 1:23
cst_kvp30-Jun-08 1:23 
AnswerRe: avoid duplicates in list Pin
DaveyM6930-Jun-08 1:34
professionalDaveyM6930-Jun-08 1:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.