如何嵌套三个内联标记块?

时间:2019-06-25 15:44:05

标签: c# asp.net-core kendo-ui nested

我正在尝试使用Kendo UI将三件事相互嵌套-具体来说,是将一个div作为面板栏项的内容,该内容位于选项卡中。我收到此错误:Inline markup blocks (@<p>Content</p>) cannot be nested. Only one level of inline markup is allowed.

我查看了以下链接:Kendo widgets two level deep in Razor, inline markup blocks cannot be nested

但是我不能使用它,因为@helper指令已在ASP.NET Core中删除,并且该修补程序可用于ASP.NET MVC。 .NET Core有什么方法可以解决这个问题?

这是错误的代码:

 @(
    Html.Kendo().TabStrip()
        .Name("Stages")
        .Items(stage => {
            stage.Add().Text("Confirm Selections").Content(@<text>
                @(
                    Html.Kendo().PanelBar()
                        .Name("Selections")
                        .Items(panelbar => {
                            panelbar.Add().Text("Selected ECUs")
                                .Content(@<div id="confirm" class="text-center"></div>);
                        })
                )
            </text>);
        }
    )
)

再次出现错误:Inline markup blocks (@<p>Content</p>) cannot be nested. Only one level of inline markup is allowed.

有什么解决方法吗?

2 个答案:

答案 0 :(得分:0)

我找不到解决此问题的方法。看来这实际上是剃刀问题,而不是Kendo UI问题。

https://www.telerik.com/forums/three-four-or-more-level-of-hierarchy-on-a-grid

我建议向Telerik提交票证,看看他们是否可以为您提供更具体的答案。

答案 1 :(得分:0)

用这样的字符串定义PanelBar的内容:

@(Html.Kendo().TabStrip()
    .Name("Stages")
    .Items(stage => {
        stage.Add().Text("Confirm Selections").Content(@<text>
            @(Html.Kendo().PanelBar()
            .Name("Selections")
            .Items(panelbar => {
                panelbar.Add()
                    .Text("Selected ECUs")
                    .Content("<div id=\"confirm\" class=\"text-center\">Test data</div></text>");
                })
            )
        </text>);
    })
)