Kendo panelBar.append 内容
Kendo panelBar.append Content
我想使用 panelBar.append 添加一个新面板,使用 .Content(@<text></text>);
格式化内容
像这个例子当我使用panelBar.Add()
panelbar.Add().Text("New Person")
.Content(@<text>
<br />
<br />
<div class="form-group">
@Html.LabelFor(model => model.firstName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.firstName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.firstName, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.surName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.surName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.surName, "", new { @class = "text-danger" })
</div>
</div>
</text>);
$("#panelbar").kendoPanelBar();
var panelBar = $("#panelbar").data("kendoPanelBar");
panelBar.append(
{
text: "New Person",
encoded: true,
content: "How to I place this <text>?"
}
)
如何使用 .append 执行此操作?
谢谢
因此您需要设置 encoded: false
以呈现 html 而您不需要 <text>
那你应该可以做到...
panelBar.append(
{
text: "New Person",
encoded: false,
content: '<br /><br /><div class="form-group">@Html.LabelFor(model => model.firstName, htmlAttributes: new { @class = "control-label col-md-2" })<div class="col-md-10">@Html.EditorFor(model => model.firstName, new { htmlAttributes = new { @class = "form-control" } })@Html.ValidationMessageFor(model => model.firstName, "", new { @class = "text-danger" })</div></div><div class="form-group">@Html.LabelFor(model => model.surName, htmlAttributes: new { @class = "control-label col-md-2" })<div class="col-md-10">@Html.EditorFor(model => model.surName, new { htmlAttributes = new { @class = "form-control" } })@Html.ValidationMessageFor(model => model.surName, "", new { @class = "text-danger" })</div></div>'
});
不要忘记在页面加载时调用助手(html 创建),而不是在调用 JS 函数时调用
我想使用 panelBar.append 添加一个新面板,使用 .Content(@<text></text>);
像这个例子当我使用panelBar.Add()
panelbar.Add().Text("New Person")
.Content(@<text>
<br />
<br />
<div class="form-group">
@Html.LabelFor(model => model.firstName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.firstName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.firstName, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.surName, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.surName, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.surName, "", new { @class = "text-danger" })
</div>
</div>
</text>);
$("#panelbar").kendoPanelBar();
var panelBar = $("#panelbar").data("kendoPanelBar");
panelBar.append(
{
text: "New Person",
encoded: true,
content: "How to I place this <text>?"
}
)
如何使用 .append 执行此操作? 谢谢
因此您需要设置 encoded: false
以呈现 html 而您不需要 <text>
那你应该可以做到...
panelBar.append(
{
text: "New Person",
encoded: false,
content: '<br /><br /><div class="form-group">@Html.LabelFor(model => model.firstName, htmlAttributes: new { @class = "control-label col-md-2" })<div class="col-md-10">@Html.EditorFor(model => model.firstName, new { htmlAttributes = new { @class = "form-control" } })@Html.ValidationMessageFor(model => model.firstName, "", new { @class = "text-danger" })</div></div><div class="form-group">@Html.LabelFor(model => model.surName, htmlAttributes: new { @class = "control-label col-md-2" })<div class="col-md-10">@Html.EditorFor(model => model.surName, new { htmlAttributes = new { @class = "form-control" } })@Html.ValidationMessageFor(model => model.surName, "", new { @class = "text-danger" })</div></div>'
});
不要忘记在页面加载时调用助手(html 创建),而不是在调用 JS 函数时调用