0

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.

Seong Lee
  • 10,314
  • 25
  • 68
  • 106

1 Answers1

3

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);
  })
)
Atanas Korchev
  • 30,562
  • 8
  • 59
  • 93