无法为数据绑定标签设置标签内容。我找到了一个如何使用webforms语法的示例,但无法将其成功转换为razor:
这是webforms语法from here:
.BindTo(Model,
(item, navigationData) =>
{
item.Text = navigationData.Text;
item.ImageUrl = navigationData.ImageUrl;
item.Content = () =>
{%>
Some random content I want to appear
<% };
})
以下是我在Razor中尝试的方法:
@(Html.Kendo().TabStrip()
.Name("OrderDetailsTabs")
.BindTo(Model, (item, model) =>
{
item.Text = "Part: " + model.WOHdr.OrderDetailId; // tab text
item.Content = () =>
{
(@<text>
Test @(model.WOHdr.Id)
</text>);
};
产生错误:
A local variable named 'item' cannot be declared in this scope because it would give a different meaning to 'item', which is already used in a 'parent or current' scope to denote something else
答案 0 :(得分:0)
你必须使用.InlineTemplate ...而不是.Content
tab.Template.InlineTemplate =
@<text>
@(Html.EditorFor(model => tabModel, "WorkOrder", tabModel))
</text>;