1

我想使用 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 执行此操作?谢谢

4

1 回答 1

2

所以你需要设置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函数时

于 2015-06-26T12:47:08.340 回答