2017-08-10 75 views
-1

我有一个关于从Kendo Editor中删除所有可能性标记的查询。我尝试过/ < [^>] *> /和其他reg表达式,但无法使其正常工作。使用kendoEditor从MVC中的HTML TextArea中删除所有标记

这里我附上了我的编辑器。

Remove HTML tags 任何人都可以告诉我如何从检索到的数据中删除所有这些标签和样式属性,并只获取纯文本。

回答

0

要显示出样式标签的内容,您必须在您的html文件中添加.Encode(False)

如:

 <div> 
     @(Html.Kendo().Editor().Encode(false) 
          .Name("Description") 

          .HtmlAttributes(new { style = "width:200%;height:400px;", @id = "Ceditor" }) 
          .Tools(tools => tools 
           .Clear() 
           .Bold().Italic().Underline().Strikethrough() 
           .JustifyLeft().JustifyCenter().JustifyRight().JustifyFull() 
           .InsertUnorderedList().InsertOrderedList() 
           .Outdent().Indent() 
           .CreateLink().Unlink() 
           .InsertImage() 
           .InsertFile() 
           .SubScript() 
           .SuperScript() 
           .TableEditing() 
           .ViewHtml() 
           .Formatting() 
           .CleanFormatting() 
           .FontName() 
           .FontSize() 
           .FontColor().BackColor() 
           .Print() 
         ) 
          .Value(@<text> 
         </text>) 
        ) 
       </div> 
相关问题