user3446885
user3446885

Reputation: 11

Kendo UI Tab Strip

I am using ASP.NET MVC 4 along with Kendo UI. How do I load TabStrip content using Ajax, keeping in mind there are different views (.cshtml).

The last TabStrip item (Action, Controller) never loads.

@(Html.Kendo().TabStrip()
              .Name("tabstrip")
              .Items(tabstrip =>
              {
                  tabstrip.Add().Text("Dimensions & Weights")
                      .Selected(true)
                      .LoadContentFrom(Url.Content("~/Content/tabstrip/ajax/ajaxContent1.html"));

                  tabstrip.Add().Text("Engine")
                      .LoadContentFrom(Url.Content("~/Content/tabstrip/ajax/ajaxContent2.html"));

                  tabstrip.Add().Text("Chassis")
                      .LoadContentFrom("AjaxLoadedPersonalItem", "Home");
                      //.Content(Html.Action("AjaxLoadedPersonalItem", "Home").ToString());
              })
        )

Upvotes: 1

Views: 2310

Answers (2)

vapcguy
vapcguy

Reputation: 7537

You would have to ensure that AjaxLoadedPersonalItem is a name of a view located in your Views\Home folder and has a function in your HomeController class, in your Controllers, to return it:

public ActionResult AjaxLoadedPersonalItem()
{
    return View();
}

Then your view would need to be checked to see if it can be rendered on its own if you went to the page directly by going to /Home/AjaxLoadedPersonalItem off of your site's root. Assuming that is all there and working:

tabstrip.Add().Text("Chassis")
    .LoadContentFrom("AjaxLoadedPersonalItem", "Home");

should work, as you have, but you can also try loading it as a partial view:

tabstrip.Add().Text("Chassis")
    .Content(@<text>@Html.Partial("AjaxLoadedPersonalItem")</text>);

Upvotes: 0

EdsonF
EdsonF

Reputation: 2818

Are you sure you have a view call AjaxLoadedPersonalItem under the Views/Home ?

This is the only reason I can see for this not to load.

For example I've just tried the code below and it worked fine

enter image description here

This is structure I've added to the MVC project

To the controller enter image description here

and the respective views

enter image description here

And this was the result:

enter image description here

Hope it may help

Upvotes: 2

Related Questions