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]
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]