Reputation: 11
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
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
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
This is structure I've added to the MVC project
To the controller
and the respective views
And this was the result:
Hope it may help
Upvotes: 2