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

  • Home
  • SEARCH
  • 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 8577023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:04:11+00:00 2026-06-11T20:04:11+00:00

I am getting a bit confused with this and need a little help please.

  • 0

I am getting a bit confused with this and need a little help please. I am developing a ASP.Net MVC 3 Web application using Entity Framework 4.1.

I have a DropDownList on one of my Razor Views, and I wish to display a list of Full Names, for example

Tom Jones 
Michael Jackson 
James Brown

In my Controller I retrieve a List of User Objects, then select the FirstName and LastName of each User, and pass the data to a SelectList.

List<User> Requesters = _userService.GetAllUsersByTypeIDOrgID(46, user.organisationID.Value).ToList();

var RequesterNames = from r in Requesters
                     let person = new { UserID = r.userID, FullName = new { r.firstName, r.lastName } }
                     orderby person.FullName ascending
                     select person;

viewModel.RequestersList = new SelectList(RequesterNames, "UserID", "FullName");

return View(viewModel);

In my Razor View I have the following

@Html.DropDownListFor(model => model.requesterID, Model.RequestersList, "Select", new { @class = "inpt_a"})
@Html.ValidationMessageFor(model => model.requesterID)

However, when I run the code I get the following error

At least one object must implement IComparable.

I feel as if I am going about this the wrong way, so could someone please help with this?

Thanks.

  • 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-11T20:04:12+00:00Added an answer on June 11, 2026 at 8:04 pm

    In your LINQ query FullName should be declared like this, otherwise EF doesn’t know how to order on the anonymous object you created:

    FullName = r.firstName + " " + r.lastName
    

    Example:

    var RequesterNames = 
        from r in Requesters
        let person = new { UserID = r.userID, FullName = r.firstName + " " + r.lastName }
        orderby person.FullName ascending
        select person;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a bit confused by the behavior of ASP.NET MVC with it not changing
I am getting myself a bit confused about how to go about this. My
This might be a very basic question, but I'm getting a bit confused. I'm
I'm getting a bit confused with UIViews recently, I have been using them fine
This should be obvious, but I'm getting a bit confused about PHP variable scope.
So, I'm a bit confused on this error that I'm getting while compiling/linking a
I am getting a bit confused. I am creating an app with storyboard, and
Switching to GCC for the first time, and I'm getting a bit confused by
I'm getting a bit confused on how to use the simulator to build applications
I am working on a school project that uses ASP.NET. I found this TextEditor

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.