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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:53:37+00:00 2026-05-13T11:53:37+00:00

Is there any to return what rank in a list something is in during

  • 0

Is there any to return what rank in a list something is in during a sort using jquery? Essentially, I want to do what thousands of others are doing (and I’ve searched thoroughly on stackoverflow) and have a database update from a sortable.

Each item in the database has a “Position” property – initially set to 0. The ul is populated and drawn out, and I want to route back to the controller when it is updated and store their positions in the list.

I am using ASP.NET MVC/C# as my code base – but I am having trouble finding full examples of this.

  • 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-05-13T11:53:38+00:00Added an answer on May 13, 2026 at 11:53 am

    Hah! I figured it out. I’m posting it here for everyone to enjoy.

    $("ul#unorderedListIdGoesHere li").index(ui.item);
    
    
    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<IEnumerable<Models.Section>>" %>
    
        <ul id="sections">
        <% foreach (var item in Model) { %>
        <li class="ui-state-default" id="<%= item.Id %>">
            <span class="ui-icon ui-icon-arrowthick-2-n-s"></span><%= Html.Encode(item.Name) %>
        </li>
        <% } %>
        </ul>
    
    <script type="text/javascript">
        $(document).ready(function() {
        $("#sections").sortable({
        update: function(event, ui) {
                $("ul#sections li").each(function(){
                    var position = $("ul#sections li").index(this);
                    var section = $(this).attr("id");
                    $.post("/Sections/Position", { position: position, section: section });
                    })
                }
            }).disableSelection();
        });
    </script>
    <style type="text/css">
        #sections { list-style-type: none; margin: 0; padding: 0; width: 60%; }
        #sections li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1.4em; height: 18px; }
        #sections li span { position: absolute; margin-left: -1.3em; }
    </style>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

is there any example on using java method to call rhino-javascript function and return
Is there any possibility to return multiple values from method? Something like this: def
Is there any way to return an array from a function? More specifically, I've
For any given NSManagedObject, is there any method to return a set or array
Is there any way to catch key combination ctrl + x + return in
Is there any difference between: public ActionResult logOff() { FormsAuth.SignOut(); return RedirectToAction(index, Home); }
Is there any way to do the following: validateLogin(); return false; But actually like
Are there any differences between get_object_vars($obj) and (array) $obj ? Both seem to return
I would like to know if there is any way to return an char
...and return the number as string. How can I do that? Is there any

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.