0

我有 html 模板,我等待将其附加到文本框问题是想问如何
从 html 文件中删除标签并添加换行 html 模板示例

PHONE/REMOTE SUPPORT TICKET<br>
<br>
Support Type:  PHONE / REMOTE ACCESS / EMAIL<br>
CSL#:<br>
Clients Name:<br>
Clients Phone#:<br>
Clients Email:<br>
<br>
<br>
Clients Issue:<br>
<br>
<br>
<br>
<br>
Issues Resolved:<br>
Follow-up Required:<br>
On-Site/Shop Service Required:<br>
Support Time:<br>

C#:附加文本框 txtb_Description

    protected void lnkb_clientRMA_Click(object sender, EventArgs e)
    {

        String text = File.ReadAllText(Server.MapPath("WebTemplates/seagate_rma.html"));
        txtb_Description.Text = WebUtility.HtmlDecode(text);
    }
4

1 回答 1

6

你可以使用替换

    string txt = WebUtility.HtmlDecode(text);
    txt = txt.Replace("<br>", Controlchars.NewLine);
    txt = txt.Replace("<br/>", Controlchars.NewLine);
    txtb_Description.Text = txt;

或者,更复杂的正则表达式,取决于您的应用程序。

于 2012-12-10T18:57:52.853 回答