This question is locked. New answers and comments are not allowed.
Hi,
I'm trying to create a tabstrip by binding to a model. A configuration file will declare how many tabs there wil be. All tabs will direct to the same controller with different values. I want all tabs to load content on demand. In all examples that use the LoadContentFrom method the contents is static. I have found someone with the same question here. But there is no answer.
My solution does load all the content as required but returns a partial view instead of showing the new content in place. Just the partialview is shown. My guess is there is a problem with loading; it isn't loaded asynchronously.
I have browsed the code of Telerik; LoadContrentFrom in the end uses a UrlHelper.Action method.
Here's some code.
BTW I have created an extension method to be able to debug the code that is supposed to go in to the view. Here's (part of) my view:
Here 's GetTabstrip method.
Here is the SetAction method:
Here's the Planning method on the controller Planning
Browsing the Telerik code I have seen that LoadContent from is called on ContentNavigationItemBuilder and returns a TBuilder. So in my case that would be a Tabstripbuilder. Where should I 'get' it or create it? My guess would be the SetAction method.
Or is my problem something completely different?
BTW As you can see I'm loading a tree view for each tab. So I also experience this problem.
I'm trying to create a tabstrip by binding to a model. A configuration file will declare how many tabs there wil be. All tabs will direct to the same controller with different values. I want all tabs to load content on demand. In all examples that use the LoadContentFrom method the contents is static. I have found someone with the same question here. But there is no answer.
My solution does load all the content as required but returns a partial view instead of showing the new content in place. Just the partialview is shown. My guess is there is a problem with loading; it isn't loaded asynchronously.
I have browsed the code of Telerik; LoadContrentFrom in the end uses a UrlHelper.Action method.
Here's some code.
BTW I have created an extension method to be able to debug the code that is supposed to go in to the view. Here's (part of) my view:
<div class="tabcontainer"> @Html.GetTabstrip(tabservice.Planning)@'Planning contains the items for the menu </div> <div > <h1>Some text</h1> </div> <div class="tabcontainer"> @Html.Action("Planning", New With {.day = DateTime.Today}) </div>
Here 's GetTabstrip method.
<System.Runtime.CompilerServices.Extension()>Public Function GetTabstrip(helper As HtmlHelper, availableItems As IEnumerable(Of MW.Telerik.Ui.Extensions.IMwForTNavgationItem)) As Telerik.Web.Mvc.UI.TabStripBuilderDim bindingDelegate As Action(Of Telerik.Web.Mvc.UI.TabStripItem, IMwForTNavgationItem)bindingDelegate = AddressOf TelerikExtensionHelper(Of Telerik.Web.Mvc.UI.TabStripItem).SetActionReturn helper.Telerik().TabStrip().Name("Tabs").BindTo(Of IMwForTNavgationItem)(availableItems, bindingDelegate)End FunctionHere is the SetAction method:
Public Shared Sub SetAction(telerikNavigationItem As TNavigationItem, mwNavigationItem As IMwForTNavgationItem) Dim values As System.Web.Routing.RouteValueDictionary If (mwNavigationItem.RouteValues Is Nothing) Then values = New RouteValueDictionary() Else values = mwNavigationItem.RouteValues End If telerikNavigationItem.Action("Planning", "Planning", mwNavigationItem.RouteValues) telerikNavigationItem.Text = mwNavigationItem.Text telerikNavigationItem.Enabled = mwNavigationItem.Enabled telerikNavigationItem.Visible = True If (Not String.IsNullOrEmpty(mNavigationItem.ImageUrl)) Then telerikNavigationItem.ImageUrl = mwNavigationItem.ImageUrl telerikNavigationItem.Selected = mwNavigationItem.Selected End SubHere's the Planning method on the controller Planning
Function Planning(day As DateTime) As ActionResult Dim planningService As New PlanningService() Dim model As New TreeViewModel 'A model to bind to a tree model.Items = planningService.GetDayplanning(day) 'all items in the model implement there respective routevalue Return PartialView("../TreeView/_TreeView", model) End FunctionBrowsing the Telerik code I have seen that LoadContent from is called on ContentNavigationItemBuilder and returns a TBuilder. So in my case that would be a Tabstripbuilder. Where should I 'get' it or create it? My guess would be the SetAction method.
Or is my problem something completely different?
BTW As you can see I'm loading a tree view for each tab. So I also experience this problem.