• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
路过的世界
释迦摩尼说过:众生皆有如来佛生相,求佛求人不如求己。
博客园    首页    新随笔    联系   管理    订阅  订阅

嵌套错误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>
                );
        }
    }
}

 

posted @ 2014-08-21 10:33  路过的世界  阅读(516)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3