【问题标题】:How to display text with angle brackets in innerText of a richtextbox?如何在富文本框的 innerText 中显示带尖括号的文本?
【发布时间】:2016-06-15 06:43:16
【问题描述】:

我正在从包含尖括号内的一些文本的文本文件中读取文本,例如“<sometext>” 我正在使用richtextbox (jquery.cleditor.js) 来显示此文本。

tbxImgSpellCh.InnerText = text;

richtextbox 中缺少尖括号内的文本。

我已尝试将代码更改为

tbxImgSpellCh.InnerHtml = text;

但是在richtextbox中仍然缺少尖括号内的文本。

我正在使用 htmlEncode 在尖括号中显示文本

text = HttpUtility.HtmlEncode(text);

现在尖括号内的文本显示在richtextbox中,但问题是它还显示其他html标签,如<br/>,   &等。

如何隐藏其他html标签并在尖括号中显示文本以及其他文本?

【问题讨论】:

    标签: c# html asp.net tags richtextbox


    【解决方案1】:

    在 web.config 中添加以下代码行以允许此字符

      <pages validateRequest="false" ></pages>
    

    【讨论】:

    • 无法在 web.config 中使用
    猜你喜欢
    • 2010-10-14
    • 1970-01-01
    • 2012-06-26
    • 2011-09-23
    • 2019-06-10
    • 2013-01-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多