What I'm trying to do
What I'm trying to do is use a server bound grid that uses templates for 2 of its rows inside of a tab strip that I would like to get loaded using "LoadContentFrom" to take advantage of on demand loading. In addition to that, I need to implement sorting on the grid.
What I've already tried
I have tried numerous ways to make this happen but have not had any success. To temporarily solve this problem, I am using the "Content" function to load the data in my tab strips. The down side of this is that all the data in all my tab strips gets loaded on page load. This causes the page to load slower and each time I click on a column header to sort, the page refreshes.
Summary question
So my question is, is it possible to have a tab strip that uses the "LoadContentFrom" method and have a server bound grid within one of the tab strips that can sort? If it is possible, can someone give me an example of what that would look like?
My development environment
I am work on an MVC 4 based project. I am using VB.NET as my programming language. I am fine with someone providing an answer using C#.
What my code looks like now
Below is an example of the code that I have now.
Tab strip code
@Imports CommericalPortal.BusinessData.Entities
@Imports CommericalPortal.Web.Models.Entities
@imports CommericalPortal.Web.My.Resources
@ModelType Customer
@Code
ViewBag.Settings.PageTitle = Model.OperatingName
Dim lastSavedTabIndex As Integer
If Request.Cookies("TabCustomersPolicySavedIndex") IsNot Nothing AndAlso IsNumeric(Request.Cookies "TabCustomersPolicySavedIndex").Value) Then
lastSavedTabIndex = CInt(Request.Cookies("TabCustomersPolicySavedIndex").Value)
Else
lastSavedTabIndex = 1
End If
End Code
@(Html.Kendo().TabStrip().Name("TabCustomers").SelectedIndex(lastSavedTabIndex) _
.Items(Sub(actions)
actions.Add().Text(TabText.ContactInfoTab).Content(Html.Action("ByLocation", "Contacts", New With {.asPartial = True}).ToHtmlString)
actions.Add().Text(TabText.PoliciesTab).Content(Html.Action("ByLocation", "Policies", New With {.asPartial = True}).ToHtmlString)
actions.Add().Text(TabText.InvoicesTab).Content(Html.Action("ByLocation", "Invoices", New With {.asPartial = True}).ToHtmlString)
actions.Add().Text(TabText.ClaimsTab).Content(Html.Action("ByLocation", "Claims", New With {.asPartial = True}).ToHtmlString)
actions.Add().Text(TabText.BillingTab).Content(Html.Action("ForCustomer", "Billing", New With {.asPartial = True}).ToHtmlString)
End Sub) _
.Events(Sub(x)
x.Select("onSelect")
End Sub)
)
<script>
function onSelect(e) {
SetupTabStripToRememberActiveTabBetweenPageCalls
("TabCustomers", "TabCustomersPolicySavedIndex");
}
</script>
Tab strip contents code (grid)
@ModelType ilist(of CommericalPortal.BusinessData.Entities.PACInformation)'
@imports CommericalPortal.Web
@(Html.Kendo.Grid(Model).Name("DisplayPAC") _
.Columns(Sub(columns)
columns.Bound(Function(model) model.AccountNumber).Title(CommericalPortal.BusinessData.Resources.BillingAndInvoices.PacAccountNumberLabel_ShortForm).Sortable(False)
columns.Bound(Function(model) model.BankNumber).Title(CommericalPortal.BusinessData.Resources.BillingAndInvoices.PacBankNumberLabel_ShortForm)
columns.Bound(Function(model) model.TransitNumber).Title(CommericalPortal.BusinessData.Resources.BillingAndInvoices.PacTransitNumberLabel_ShortForm)
columns.Bound(Function(model) model).Template(Function(obj) String.Format("<a href='{0}/{1}'>{2}</a>", Url.Content("~/PAC/Edit"), obj.ID, CommericalPortal.Web.My.Resources.GridText.EditLinkText)).Title("")
columns.Bound(Function(model) model).Template(Function(obj) String.Format("<a href='{0}/{1}'>{2}</a>", Url.Content("~/PAC/ViewCheques"), obj.ID, CommericalPortal.Web.My.Resources.GridText.ViewChequesLinkText)).Title("")
End Sub) _
.Sortable(Function(sorting) sorting.SortMode(GridSortMode.SingleColumn).Enabled(True))
)