c# - razor 下拉列表中的 UrlDecode 未解码字符串
问题描述
UrlDecode 不解码剃刀下拉列表中的字符串。这是我尝试过的:
我试过使用 WebUtility.UrlDecode 和 HttpUtility.UrlDecode
@Html.DropDownListFor(m => m.questions, new SelectList(Model.questions,
"id", WebUtility.UrlDecode("Answer")), null, new { @class = "data"})
下拉列表中的字符串,例如“My%20House”未解码为“My House”
解决方案
你可以使用类似的东西:
@Html.Raw(YourValue)
或者
@Html.Raw(HttpUtility.HtmlDecode(YourValue));
推荐阅读
- php - 在 Laravel 中单击提交时重复的表单验证错误
- ios - 为什么应用程序在发布模式下显示白屏?
- javascript - 如何在 Django 中使用 JavaScript 获取图表的值?
- svg - SVG d3 中带阴影的箭头标记
- node.js - 无服务器/无状态环境中的 Gatsby 预览服务器
- google-cloud-platform - 按凭据 ID 对 API 端点的指标分组不适用于 JWTtokens
- eclipse - Eclipse Tomcat 文件部署
- python-3.x - 使用 boto3 检查 AWS Lambda 是否正在执行中
- docker - 在 docker run 命令中传递参数
- javascript - 如何设置 SVG 图像的样式以延迟更改颜色