开发者

How to get Plain Text from HTML editor in ASP.NET AJAX Control Toolkit?

How to get Plain Text from HTML editor in ASP.NET AJAX Cont开发者_Python百科rol Toolkit?

Editor1.Content gives HTML text like

This is <span style=\"font-weight: bold\">BOLD</span> text

while i want plain text only

This is BOLD text


Just write this method in your code:

public static string GetTextonly(string editorcontent)
{
    string strtext = "";
    strtext = Regex.Replace(editorcontent, @"<(.|\n)*?>", string.Empty);
    return strtext;
}

after write this outside:

string plaintext = GetTextonly(txtMessage.Content);

you just add namespace for System.Text.RegularExpression

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜