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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:33:13+00:00 2026-06-18T09:33:13+00:00

I am working with MVC4 in producing a dynamic list that contains a number

  • 0

I am working with MVC4 in producing a dynamic list that contains a number of elements. For example the markup for such is as follows:

    <ul>
<li class="item" data-price="1" data-categoryid="200,300,400">
<!-- further markup -->
</li>
<li class="item" data-price="4" data-categoryid="210,310,400">
<!-- further markup -->
</li>
<li class="item" data-price="3" data-categoryid="220,030,430">
<!-- further markup -->
</li>
<li class="item" data-price="6" data-categoryid="250,300,410">
<!-- further markup -->
</li>
</ul>

The data for the above markup is populated via an MVC model from a controller action when the page loads.

I have a number of things I want to achieve with this markup that I need assistance with. For starters, also on my page I have a number of checkboxes that correspond to the “data-categoryid” attribute above. For example I have checkbox 200, 300 etc. When the user checks any of these boxes, I only want to display the li tags that contains the value of the checkbox in the data-categoryid attribute?

I also have a drop down when a user selects price in it, I would like the li tags to order based upon the “data-price” attribute in the li’s?

I am working with jquery and knockout (keen to learn this) so looking to work with these to accomplish this.

I have added the markup to http://jsfiddle.net/tE6fb/

I have to further questions on the above. As mentioned I populated such via controller returning a view etc. As the user scrolls down the page, I will use infinite scrolling to make a server side call to return the next list of li tags and append them on to the above. I am thinking for ease of use, populate the partial view on the server and returning the content of it and append to the markup.

The alternative is not to load the markup at the start via server side but via client side, and bind the li tags with knockout. However I am concerned that by using this approach, no markup resides on the page on first load resulting in a delay for the user and also search engine bots wont be able to index this markup. Is my understanding of the above correct or is there a better way?

  • 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-18T09:33:14+00:00Added an answer on June 18, 2026 at 9:33 am

    http://api.jquery.com/

    var $li = $('ul li');
    $('input[type=checkbox]').change(function(){
       $li.filter('[data-categoryid*='+ this.value +']').toggle(this.checked);
    });
    
    $('select').change(function(){
        $li.sort(function(a, b){
            return a.dataset.price > b.dataset.price 
        }).appendTo('ul');
    });
    

    http://jsfiddle.net/zPfWj/

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

Sidebar

Related Questions

Every example that I can find of an MVC4 app has the edit working
Working with an undisclosed API, I found a function that can set the number
I am working on creating a MVC4 multi-tenant site that uses seperate DBs for
I have an MVC4 application that I am working on and I am trying
I'm working on upgrading an application from MVC3 to MVC4 and noticed something that
I have a Kendo Grid in MVC4 that is working fine: Html.Kendo().Grid<SearchUserResultViewModel>() .Name(Grid) .Columns(columns
I'm working on an MVC4 project that has site controllers and API controllers. How
I am working on an MVC4 razor project. I have a list of role
I am working on a project with MVC4, and have decided that I wish
I'm working with ASP.NET MVC4 WebApi and Knockout.js. My model consists of Pages that

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.