Kendo PanelBar HTML string as Content

1k views Asked by At

I am implementing a view where there are tabs (Kendo TabStrip) and inside these tabs are some accordion items (Kendo PanelBar). I dinamically draw the tabs using a foreach, and in each tab, I also use a foreach to draw the accordion. The thing is that, the content of each accordion item is a HTML string (like: <p>Some <strong>text</strong></p>). In chrome all work fine, but with IE8 everything goes out (because the page HTML mixes with the string HTML).

This is my code:

@(Html.Kendo().TabStrip()
          .Name("tabAyuda")
          .HtmlAttributes(new { style = "" })
          .Animation(false)
          .SelectedIndex(0)
          .Items(tabAyuda =>
          {
                foreach (KeyValuePair<string, IList<ElementoAyuda>> accion in Model)
                {
                    if (!string.IsNullOrWhiteSpace(accion.Key))
                    {
                        tabAyuda.Add().Text(accion.Key)
                            .Content(@<text>
                                @(Html.Kendo().PanelBar()
                                    .Name("panelbar" + accion.Key)
                                    .ExpandMode(PanelBarExpandMode.Single)
                                    .Items(panelbar =>
                                    {
                                        foreach (ElementoAyuda elemento in accion.Value)
                                        {
                                            panelbar.Add()
                                                .Text(elemento.Head)
                                                .Content(elemento.Detail);
                                        }
                                    })
                                        )
                            </text>); 
                    }
                }
          })
          )

I've also tried with this code inside .Content:

.Content(@<text>                                                    
@Html.Raw(elemento.Detail)
</text>)

But I get this error: Custom tool error: Inline markup blocks (@<p>Content</p>) cannot be nested. Only one level of inline markup is allowed.

Any advice??

Thanks in advance!

1

There are 1 answers

0
javiazo On

Solved, it was my fault. Some of the HTML strings had invalid syntax, but somehow in Chrome works XD