Emjaycobs
Emjaycobs

Reputation: 1

UrlDecode in razor dropdownlist is not decoding string

UrlDecode is not decoding strings in a razor drop down list. Here is what I have tried:

I have tried using WebUtility.UrlDecode and HttpUtility.UrlDecode

@Html.DropDownListFor(m => m.questions, new SelectList(Model.questions, 
"id", WebUtility.UrlDecode("Answer")), null, new { @class = "data"})

String in drop down list such as "My%20House" not decoding to "My House"

Upvotes: 0

Views: 56

Answers (1)

Abhishek
Abhishek

Reputation: 100

You can use something like :

@Html.Raw(YourValue)

or

@Html.Raw(HttpUtility.HtmlDecode(YourValue));

Upvotes: 2

Related Questions