Ian Vink
Ian Vink

Reputation: 68750

Kendo TabStrips: Adding a Template

Using Kendo Tabstrip in MVC 4.

I have a tabstrip. Each tab contains a number of form fields for the overall page form.

Right now I add the fields as below, it's very messy though. Is there a way to use some kind of Template where I don't have to concat strings together?

Here's what I have to do currently:

    @(Html.Kendo().TabStrip()
          .Name("tabFormItems")
          .Items(items =>
              {
                  items.Add().Text("Rex Online").Content(
                      "<table><tr>" +
                      "<td>" + Html.LabelFor(x => x.ClientID).ToString() + "</td>" +
                      "<td>" + Html.EditorFor(x => x.ClientID).ToString() + "</td>" +
                      "</tr></table>")

Upvotes: 1

Views: 2567

Answers (1)

Atanas Korchev
Atanas Korchev

Reputation: 30671

Yep. You can use a Razor template delegate as shown in this example: http://demos.kendoui.com/web/tabstrip/index.html

Here is the relevant code:

tabstrip.Add().Text("New York")
              .Content(@<text>
                <div class="weather">
                    <h2>29<span>&ordm;C</span></h2>
                    <p>Sunny weather in New York.</p>
                </div>
                <span class="sunny">&nbsp;</span>
              </text>);

Upvotes: 2

Related Questions