Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8755975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:57:44+00:00 2026-06-13T13:57:44+00:00

I have the following information return in the grid, but it would not order

  • 0

I have the following information return in the grid, but it would not order the record first order by firstname then family name. Please let me know how i can achieve this. I am currently using MVC4 and kendoui grid

public ActionResult Index()
    {
        return View();
    }

public ActionResult GetSession([DataSourceRequest] DataSourceRequest request)
{
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    return Json(GetAllSessionList().ToDataSourceResult(request),         JsonRequestBehavior.AllowGet);
} 
 private static IEnumerable<ListsViewModel> GetAllSessionList()
    {
        var context = new HEntities();

        return context.vwSessionListConfigs
            .OrderBy(x => x.FirstName).ThenBy(x => x.FamilyName)
            .Select(session => new ListsViewModel
            {
                ConsumerID = session.ConsID,
                ConsumerHCID = session.ConsHCL,
                ConsumerHRN = session.ConsHRK,
                ConsumerFirstName = session.FirstName,
                ConsumerFamilyName = session.GivenName,
                ConsumerGender = session.Gender,
            });
    }

View:

@(Html.Kendo().Grid<Web_App.ViewModel.ListsViewModel>()

    .Name("SList")
    .HtmlAttributes(new { @Style = "align:center; font-size:10px;" })
    .Columns(columns =>
    {
        columns.Bound(p => p.ConsID).Visible(false);
        columns.Bound(p => p.ConsHCL).Width(80);
        columns.Bound(p => p.ConsHRK).Width(50);
        columns.Bound(p => p.FirstName).Width(80);
        columns.Bound(p => p.GivenName).Width(80);
        columns.Bound(p => p.ConsumerAlias).Width(45);
        columns.Bound(p => p.Gender).Width(30);

        columns.Command(commands => commands.Edit()).Width(175);      
    })
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Pageable()
    .Selectable(s => s.Mode(Kendo.Mvc.UI.GridSelectionMode.Single))
    .Scrollable()
    .DataSource(dataSource => dataSource
        .Ajax()
        .PageSize(10)
        .ServerOperation(true)
        .Model(model => model.Id(p => p.ConsID))
        .Read(read => read.Action("GetSession", "Manage").Type(HttpVerbs.Get))
        .Update("Edit", "Manage")         
    )
    .Events(events => events
                            .Change("change"))



)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:57:45+00:00Added an answer on June 13, 2026 at 1:57 pm

    It does not matter how you sort the collection before passing it to the ToDataSourceResult method. The ToDataSourceResult method will internally again sort the collection by the first property of the model.

    To sort you collection initially you should use the Sort method of the dataSource.

    .DataSource(dataSource => dataSource
                .Ajax()
                .Sort(st => {
    
                    st.Add(m => m.Name).Descending();
                    st.Add(m => m.PersonID).Descending(); 
                })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my mysql database I have the following information in a page name field.
Ok, I have an example table with the following information and query. First up
Hi I'm using jqgrid to show some information in a grid. But I have
I have the following problem. I am currently trying to return information from a
I have two tables with the following information : Products Name | ID |
I have a data set containing the following information: Workload name Configuration used Measured
I have the following code which return wmi information (unknown array) For Each objMgmt
I have: ... post_str = Please input the following information... \nDescription: \n Last Name:
i have one form which collect user information Name Age CV and then i
I have an xml file with the following information. <?xml version=1.0?> -<Party> -<Player> <Name>Butch</Name>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.