Solved

Cant get value from a cookie to a dropdown list

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now