[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Cant get value from a cookie to a dropdown list

Posted on 2006-06-13
2
Medium Priority
?
311 Views
Last Modified: 2010-04-16
Hi there, wonder if you guys can help me. I'm new to C# and I have the following problem

I have a dropdown list, all the value are ok, bar 1, the value of that is

value="books&CD"

when a user selects this options, the result is stored in a cookie, because I had problems with the & I to change it to a *. So ...

request.Form["typeB"].Replace("&", "*");

I have another form that reads the value from the cookie and it selects the correct value the user has selected. So this is the code I have:

selected = typeB.Items.FindByValue(cookie["media"].Replace("*", "&"));

For some strange reason, this wont work? Any idea as to why this isnt working. So the code **Should** of selected the value book books&CD.


my cookie has books*CD

Thanks Guys, hope you can help out.

Thanks
0
Comment
Question by:mousemat24
2 Comments
 
LVL 5

Accepted Solution

by:
t_itanium earned 2000 total points
ID: 16900192
y r u using:
typeB.Items.FindByValue(cookie["media"].Replace("*", "&"));??

y don't u use just

cookie["media"].Replace("*", "&");
0
 

Author Comment

by:mousemat24
ID: 16901406
sorry my mistake, thanks for that t_itanium
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question