简体   繁体   English

Kendo UI-将Text()包含的文本转换为<span>编码的HTML</span>

[英]Kendo UI - Turning Text() enclosed text into <span> encoded HTML

I am trying to add style to title of a panel bar that comes with Kendo UI and I want to break this pure text of Blah-1 Blah-2 into 2 span blocks so it outputs html as <span>Blah-1</span> and <span>Blah -2</span> 我正在尝试为Kendo UI随附的面板栏的标题添加样式,我想将Blah-1 Blah-2纯文本分为2个跨度块,以便将HTML输出为<span>Blah-1</span><span>Blah -2</span>

How do I achieve that with the following? 如何通过以下方式实现?

@(Html.Kendo().PanelBar()
  .Name("panelBar")
  .Items(panelBar =>
  {
    panelBar.Add().Text("Blah-1 Blah-2")
  })
)

I've tried to encode <span> within Text() but it doesn't escape html tags. 我尝试在Text()<span>进行编码,但它无法转义html标签。

The Encode method allows you to stop HTML encoding (done by default): 使用Encode方法可以停止HTML编码(默认情况下完成):

@(Html.Kendo().PanelBar()
  .Name("panelBar")
  .Items(panelBar =>
  {
    panelBar.Add().Text("<span>Blah-1</span><span>Blah-2</span>").Encoded(false);
  })
)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM