Solved

Cant get value from a cookie to a dropdown list

Posted on 2006-06-13
2
290 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 500 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

679 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