【问题标题】:How can I nest three inline markup blocks?如何嵌套三个内联标记块?
【发布时间】:2019-06-25 15:44:05
【问题描述】:

我正在尝试使用 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 (@&lt;p&gt;Content&lt;/p&gt;) cannot be nested. Only one level of inline markup is allowed.

有什么解决方法吗?

【问题讨论】:

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


【解决方案1】:

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

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

我建议向 Telerik 提交工单,看看他们能否给你一个更具体的答案。

【讨论】:

  • 我按照您的建议向 Telerik 提交了该票证,他们能够将工作解决方案发回给我!我会把它贴在下面供其他人使用。
【解决方案2】:

用这样的字符串定义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>);
    })
)

【讨论】:

    猜你喜欢
    • 2013-11-23
    • 2012-05-27
    • 2016-12-09
    • 2010-10-30
    • 2019-06-07
    • 2014-06-16
    • 2010-11-17
    • 1970-01-01
    相关资源
    最近更新 更多