Kendo UI - 将文字()附加到< span>编码的HTML [英] Kendo UI - Turning Text() enclosed text into <span> encoded HTML
本文介绍了Kendo UI - 将文字()附加到< span>编码的HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图为Kendo UI
附带的面板栏的标题添加样式,我想打破这个纯文本 Blah-1 Blah-2
到2个跨段中,因此它输出html作为< span> Blah-1< / span>
和< span> Blah -2& / span>
如何通过以下方式实现?
@(Html.Kendo()。PanelBar()
.Name(panelBar)
.Items(panelBar =>
{
panelBar.Add()。文本(Blah-1 Blah-2)
})
)
我试图在 Text()
中编码< span>
c> c> 停止HTML编码(默认完成):
@(Html.Kendo()。PanelBar()
.Name (panelBar)
.Items(panelBar =>
{
panelBar.Add()。文本(< span> Blah-1< / span>< span& -2< / span>)。
})
)
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>
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.
解决方案
The Encode
method allows you to stop HTML encoding (done by default):
@(Html.Kendo().PanelBar()
.Name("panelBar")
.Items(panelBar =>
{
panelBar.Add().Text("<span>Blah-1</span><span>Blah-2</span>").Encoded(false);
})
)
这篇关于Kendo UI - 将文字()附加到< span>编码的HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文