I am using EF4 + MVC 3 with Razor.
I have the following ActionResult
that maps Dictionary<string,string>
to a partial view.
ACTION
public ActionResult combotest() { Dictionary<string, string> r = new Dictionary<string, string>(); r.Add("<> ''", "T"); ... return PartialView("_mypartial", r); }
Now the special characters contained in the Model.Key
values ββare HTML Encoded, while I would like to use them as plain text. For example, <> ''
appears as <> ''
<> ''
.
I tried converting them with WebUtility.HtmlDecode
or Server.HtmlDecode
without success:
PARTIAL VIEW (_mypartial):
<select> <option value=''></option> @foreach (KeyValuePair<string,string> value in (Dictionary<string, string>)Model) { <option value="@WebUtility.HtmlDecode(value.Key)">@value.Value </option> } </select>
could you help me? I would avoid using String.Replace
if possible.
Larry source share