Sortable grid using template column inside AJAX based tab strip

2 posts, 0 answers
  1. DK
    DK avatar
    1 posts
    Member since:
    Jun 2008

    Posted 30 Jul 2013 Link to this post

    I have been trying to find some help in various places for an issue that I'm having with a tabstrip and grid.

    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

        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)
            lastSavedTabIndex = 1
        End If
    End Code

    @(Html.Kendo().TabStrip().Name("TabCustomers").SelectedIndex(lastSavedTabIndex) _
                       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) _
                End Sub)

        function onSelect(e) {
    ("TabCustomers", "TabCustomersPolicySavedIndex");

    Tab strip contents code (grid)
    @ModelType ilist(of CommericalPortal.BusinessData.Entities.PACInformation)'
    @imports CommericalPortal.Web

    @(Html.Kendo.Grid(Model).Name("DisplayPAC") _
                     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))

  2. Vladimir Iliev
    Vladimir Iliev avatar
    2206 posts

    Posted 01 Aug 2013 Link to this post

    Hi Danny,

    I already answered to this query in duplicated support ticket created by you - #721351. Please keep in mind that it is highly recommended that you keep related questions in one support thread or a forum post, so that we can easily keep track of your support history and provide better answers in a shorter time.

    Kind Regards,
    Vladimir Iliev
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top