Solved

Cant get value from a cookie to a dropdown list

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Greetings C# program 17 124
Why does my excel data start at B1 instead of A1. 9 91
C# LINQ ForEach() question 6 49
C# MVC Insert Multiple Row into DB 2 30
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

791 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