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 8038703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T03:19:24+00:00 2026-06-05T03:19:24+00:00

I need to create a nested listview and found a great article on how

  • 0

I need to create a nested listview and found a great article on how to do it, but my situation is a bit different. I am a linq newbie and need a little help please 🙂

I need to get my data into a format similar in that article to work (on that link above, search for "Configuring the ListView" and see table right above it).

Here is my data:

Format    Movie Name    Price
DVD       Star Wars     12.99
DVD       Star Wars II  13.99
Blue-Ray  Star Wars     15.99
Blue-Ray  Star Wars II  17.99

Here is what I have, which isn’t really that close, but it is as far as I could get:

var MoviesToBuy = from Movie in dtMovieListDetails.AsEnumerable()
                    //join MovieDetails in dtMovieListDetails.AsEnumerable() on (string)Movie["ID"] equals (string)MovieDetails["ID"]
                    group Movie by new
                    {
                        Format = Movie["Format"],
                        Movies = Movie
                    } into grp

                    select new
                    {
                        Format = (string)grp.Key.Format,
                        Movies = grp.Key.Movies
                    };

        MoviesToBuy = MoviesToBuy.OrderBy(p => p.Format);

        lvwAmazonMovieGroup.DataSource = MoviesToBuy.ToList();
        lvwAmazonMovieGroup.DataBind();

I have 3 specific issues/questions:

1.) What I have doesn’t work. Since my second column in the group equates to all rows, no actual group is created.

2.) Despite prior issue, I am also getting "Data source is an invalid type. It must be either an IListSource, IEnumerable, or IDataSource" error. In this case, the Movies column is being created as a DataRow datatype. Not sure if that is what is creating the problem. Can I cast on that field somehow?

3.) how can I sort on the fields in the movies. I.e. in the end I want the data to be sorted by Format then Movie Name so the nested list view looks like this:

Blue-Ray
   Star Wars    12.99
   Star Wars II 13.99

DVD
   Star Wars    15.99
   Star Wars II 17.99

Any points are greatly appreciated!

Thanks in advance,
Chad

  • 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-05T03:19:26+00:00Added an answer on June 5, 2026 at 3:19 am

    I was thinking you could start with the following, adjusting for the proper variable names and AsEnumerable(), etc.

    It orders your movies as you want and puts them in a nested structure as you requested:

    var moviesToBuy = from movie in dtMovieListDetails
        orderby movie.Format, movie.Price
        group movie by movie.Format into grp
        select new
        {
            Format = grp.Key,
            Movies = grp.Select (g => new { MovieName = g.MovieName, Price = g.Price })
        };
    

    Here’s an example program that implements the above query.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I need to create a couple of nested DOM elements, I know one
I need create clone repository. but I do not know where can I get
I need to create N nested loops to print all combinations of a binary
I need to create a nested linkbuttons in a asp.net page that looks like
I need to create a nested list, four levels deep. On the fourth level,
I need to create a multi-dimensional (nested) hashtable/dictionary so that I can use syntax
Using boost python I need create nested namespace. Assume I have following cpp class
I need create custom dialog and put JPanel into it. Is it possible?
i need create an email list sending to many emails. what is best solution
I need create a document word with Java. And I ask, how can I

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.