gpt4 book ai didi

javascript - 内联标记 block (@

Content

) 不能嵌套。只允许一层内联标记

转载 作者:可可西里 更新时间:2023-11-01 02:37:09 26 4
gpt4 key购买 nike

您好,我收到错误消息:

Inline markup blocks (@<p>Content</p>) cannot be nested.  Only one level of inline markup is allowed.

将 Kendo UI 选项卡条和 MultiSelectBoxes 与 Razor View 和 MVC4 结合使用

我已经尝试实现辅助类,但我仍然遇到错误

这是我的代码,我是不是漏掉了一步?我将 3 个多选移出并用助手调用它们!

@(Html.Kendo().TabStrip()
.Name("tabstrip")
.Items(tabstrip =>
{
tabstrip.Add().Text("One")
.Content(@<div>
@RenderSelect()
</div>;);

tabstrip.Add().Text("Two")
.Content("Two");

tabstrip.Add().Text("Three")
.Content("Three");
})
.SelectedIndex(0)
)

@helper RenderSelect()
{
<h2>MyList</h2>
<label>One</label>
@(Html.Kendo()
.MultiSelect()
.Name("One")
.AutoBind(true)
.Placeholder("Select Clients...")
.DataTextField("hname")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("Client", "Dist");
})
.ServerFiltering(true);
})

)
<label>Two</label>
@(Html.Kendo()
.MultiSelect()
.Name("Two")
.AutoBind(true)
.DataTextField("gname")
.Placeholder("Select Recipients...")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("Client", "Dist");
})
.ServerFiltering(true);
})

)
<label>Three</label>
@(Html.Kendo()
.MultiSelect()
.Name("Three")
.AutoBind(true)
.DataTextField("id")
.Placeholder("Select CLL...")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("Codes", "Dist");
})
.ServerFiltering(true);
})

)
}

最佳答案

我想通了。

我必须链接助手。

所以每个多选一个帮助类。

按照这个: http://www.aspnetwiki.com/telerik-mvc:nested-container-controls-and-razor-helper

然后,如果你想在一个选项卡中进行多个多选,你将需要为每个多选提供一个帮助程序,如下所示:

这是助手,只需将其复制到第二个、第三个和第四个,然后更改名称等...

@helper RenderMultiFirstBox()
{
@(Html.Kendo()
.MultiSelect()
.Name("First")
.AutoBind(true)
.Placeholder("Select First...")
.DataTextField("name")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("Index", "Something");
})
.ServerFiltering(true);
})

)
}

然后像这样在 TabStrip 'Content' 中调用助手:

.Items(tabstrip =>
{
tabstrip.Add().Text("One")

.Content(@<text>
@RenderMultiSelectFirstBox()
@RenderMultiSelectSecondBox()</text>);

关于javascript - 内联标记 block (@<p>Content</p>) 不能嵌套。只允许一层内联标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19917893/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com