Drag and Drop Sortable Lists using jQueryUI

 How to Drag and Drop Sortable Lists using jQueryUI in asp.net:



In this post we see an Example and create a list of some items. Then at run time we sort this given list using jquery. In this asp.net tutorial we consider other popular post as like HOW TO USE JQUERY TOOLTIP WITH CSS IN ASP.NET WEB APPLICATION, HOW TO MAKE A DIGITAL CLOCK WITH JQUERY & CSS FOR DISPLAY TIME and JQUERY UI DATEPICKER (CALENDAR) EXAMPLE IN ASP.NET.

List of Jquery related Post:


Reorder list using jQuery and ASP.NET :

Use fallowing link for sorting list by jquery.  Copy these lines and Past in to head section.
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>

Jquery function for sorting list:

Here we see a  jquery function that is use to perform drag and drop list item and sort according to user.
<script>
        $(function () {
            $("#sortable").sortable();
            $("#sortable").disableSelection();
        });
    </script>

jQuery UI sortable (drag & drop) with ASP.NET

For style use give code on page
<style>
        #sortable
        {
            list-style-typenone;
            margin0;
            padding0;
            width50%;
        }
        #sortable li
        {
            margin0 3px 3px 3px;
            padding-left1.5em;
            font-size1.4em;
            height18px;
            width348px;
            padding-right0.4em;
            padding-top0.4em;
            padding-bottom0.4em;
        }
        #sortable li span
        {
            positionabsolute;
            margin-left-1.3em;
        }
    </style>

Drag-and-drop sorting for our ASP.NET

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="sort_dives.aspx.vb" Inherits="sort_dives" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
   
    <title>jQuery UI Sortable list in asp.net</title>
    <link rel="stylesheet" href="//code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css">
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script src="//code.jquery.com/ui/1.11.1/jquery-ui.js"></script>
    <style>
        #sortable
        {
            list-style-typenone;
            margin0;
            padding0;
            width50%;
        }
        #sortable li
        {
            margin0 3px 3px 3px;
            padding-left1.5em;
            font-size1.4em;
            height18px;
            width348px;
            padding-right0.4em;
            padding-top0.4em;
            padding-bottom0.4em;
        }
        #sortable li span
        {
            positionabsolute;
            margin-left-1.3em;
        }
    </style>
    <script>
        $(function () {
            $("#sortable").sortable();
            $("#sortable").disableSelection();
        });
    </script>
</head>
<body>
    <div align="center">
        <ul id="sortable"
           
            style="border: thin double #FF0000; background-color: #C0C0C0; width: 728px;">
            <h1 style="color: #990000; text-decoration: underline">
                Jquery sorting by drag and drop in asp.net</h1>
            <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>List
                Item 1</li>
            <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>List
                Item 2</li>
            <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>List
                Item 3</li>
            <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>List
                Item 4</li>
            <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>List
                Item 5</li>
            <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>List
                Item 6</li>
            <li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>List
                Item 7</li>
            <br />
        </ul>
           <br />
    </div>
</body>
</html>



jQuery UI sortable (drag & drop) with ASP.NET:

Drag and Drop Sortable Lists using jQueryUI
 Sortable Lists using jQueryUI 

Other Asp.net post on this blog:




Comments

Popular posts from this blog