zoukankan      html  css  js  c++  java
  • 嵌套错误Inline markup blocks (@<p>Content</p>) cannot be nested. Only one level of inline markup is allowed

    例子:

    @{Html.Telerik().Splitter().Name("MainSplitter")
        .Orientation(SplitterOrientation.Vertical)
        .Panes(vPanes =>
        {
            vPanes.Add()
                .Size("50px")
                .Content(
                    @<text>
                        Epx Studio
                    </text>
                )
            vPanes.Add()
                .Content(
                    @<text>
                        @{
                            @Html.Telerik().TabStrip()
                                .Items(tabstrip =>
                                {
                                    tabstrip.Add()
                                        .Text("Tab 1")
                                        .Content(
                                            @<text>
                                                @RenderSection("tabOneContents", false);
                                            </text>
                                        );
                                }
                        }
                    </text>
                );
        })
        .Render();
    }
    

    嵌套@<text>错误,错误信息Inline markup blocks (@<p>Content</p>) cannot be nested. Only one level of inline markup is allowed

    MVC 引擎不允许潜逃@<Text>,@<p> ,@div,

    解决方案,用帮助方法,帮助方法(helper function(是在view里定义的方法,使用如下

    {Html.Telerik().Splitter().Name("MainSplitter")
        .Orientation(SplitterOrientation.Vertical)
        .Panes(vPanes =>
        {
            vPanes.Add()
                .Size("50px")
                .Content(
                    @<text>
                        Epx Studio
                    </text>
                )
            vPanes.Add()
                .Content(
                    @<text>
                        @RenderTabStrip()
                    </text>
                );
        })
        .Render();
    }
    
    @helper RenderTabStrip()
    {
        @{Html.Telerik().TabStrip()
            .Items(tabstrip =>
            {
                tabstrip.Add()
                    .Text("Tab 1")
                    .Content(
                        @<text>
                            @RenderSection("tabOneContents", false);
                        </text>
                    );
            }
        }
    }
    
  • 相关阅读:
    快捷键打开远程桌面
    织梦Dedecms后台登陆密码忘记怎么办?
    Windows curl开启注意事项
    Composer教程
    composer.json和composer.lock有什么区别?
    Web.config 文件例子
    win10回收站右键有2个“CCleaner”怎么删除
    sublime快捷键
    Json 文件注意事项
    加入购物车流程
  • 原文地址:https://www.cnblogs.com/shenfengok/p/3926589.html
Copyright © 2011-2022 走看看