This is a migrated thread and some comments may be shown as answers.

Sorting Column in Telerik

0 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
abc
Top achievements
Rank 1
abc asked on 25 Mar 2014, 01:15 AM
Hi!

    I have a telerik grid, which have columns - Name, Address, Employer.
    Employer is binded by an ID. I want these columns to be Sortable. Address and Name works fine. But for Employer, it is not sorting by Employer(or text), but
    rather it is sorting by the ID.


 @(Html.Telerik().Grid<Customer>(Model)
            .Name("CustomerGrid")
            .ClientEvents(e => e.OnRowDataBound("Grid_onRowDataBound"))
            .Columns(columns =>
            {
                
                columns.Bound(customer => customer.Address).Title("Address");
                columns.Bound(customer => customer.Name).Title("Name");
                columns.Bound(customer => ID).Title("Employer");
            })
            .Pageable(p => p.PageSize(10))
            .Filterable(filtering => filtering.Enabled(false))
            .Sortable(s => s.SortMode(GridSortMode.SingleColumn)))
 


Eg-      Name     Address       Employer
    
           Abc         west street    IBM [id 2] 
           Xyz         111 street      GE [id 3]
           Pqr         north street     Microsoft [id 1]
     


After sorting by Employer i.e by employer name column it  should be--

         Name       Address       Employer
    
         Xyz          111 street     GE [id 3]
         Abc         west street    IBM [id 2] 
         Pqr          north street   Microsoft [id 1]
         
         

No answers yet. Maybe you can help?

Tags
Grid
Asked by
abc
Top achievements
Rank 1
Share this question
or