德code中的视图 [英] Decode the view

查看:109
本文介绍了德code中的视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何去code中的视图 asp.net MVC视图?它出现错误,当我code将其象下面这样:

 <%= System.Web.HttpUtility.HtmlDe code(计算机[内容])%GT;


解决方案

System.Web.HttpUtility.HtmlDe code 方法接受一个字符串,而不是的 计算机[内容 ]为对象。您应该使用的ToString()方法或类型皈依:

 <(计算机[内容]的ToString())%= System.Web.HttpUtility.HtmlDe code%GT;
<%= System.Web.HttpUtility.HtmlDe code((串)计算机[内容])%GT;

How to decode the view in asp.net MVC View? It appeared error when I code it like below:

<%= System.Web.HttpUtility.HtmlDecode(ViewData["content"]) %>

解决方案

System.Web.HttpUtility.HtmlDecode method accepts a string, rather than ViewData["content"] is object. You should use the .ToString() method or type convertion:

<%= System.Web.HttpUtility.HtmlDecode(ViewData["content"].ToString()) %>
<%= System.Web.HttpUtility.HtmlDecode((string)ViewData["content"]) %>

这篇关于德code中的视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆