在用HttpUtility.HtmlDecode转义成html画面显示的时候遇到的奇怪问题

来源:互联网 发布:淳儿心机知乎 编辑:程序博客网 时间:2024/06/08 14:16

画面html代码显示

@{
            DataTable dtReturn= (DataTable)ViewBag.DtReturnInfo;
}

@{

if (dtReturnInfo.Rows.Count > 0)
            {
                for (int i = 0; i < dtReturnInfo.Rows.Count; i++)
                {

                     <div class="divContent">

                    <p style="margin-left:10px;" class="REPLY_CONTENT" title="@HttpUtility.HtmlDecode(dtReturn.Rows[i]["REPLY_CONTENT"].ToString())"></p>

                    </div>

                }

            }

}

javascript脚本

$(".divContent").each(function () {

                $(this).find(".REPLY_CONTENT").html($(this).find(".REPLY_CONTENT").attr("title"));

})

给P标签赋值的时候必须用该标签的属性才可以把html代码在画面上正常显示。


原创粉丝点击