connectseekers.com

Tuesday, 16 February 2016

jQuery Code To Select Multiple Item By Pressing Ctrl Button In Asp.Net

2/16/2016 - By Pranav Singh 0


So for this article first we will create a new asp.net application and add the below library and css reference in header of the page.

   
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>


In header of the page add the below code and css.


<style>
        .fontsize {
            font-size: 11px;
        }

        #countrylist .ui-selecting {
            background: Red;
        }

        #countrylist .ui-selected {
            background: green;
            color: white;
        }

        #countrylist {
            list-style-type: none;
            margin: 0;
            padding: 0;
            width: 98%;
        }

        #countrylist li {
            margin: 3px;
            padding: 0.4em;
            font-size: 1.4em;
            height: 18px;
        }
    </style>


Have a look of the jQuery code.
  
 <script>
        $(function () {
            $("#countrylist").selectable();
        });
  
 </script>

This code is responsible for performing the selection operation. In above code countrylist is the id of the UL control. Here is the complete code.

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>jQuery Code To Select Multiple Item By Pressing Ctrl Button In Asp.Net</title>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
        <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
        <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    <style>
        .fontsize {
            font-size: 11px;
        }

        #countrylist .ui-selecting {
            background: Red;
        }

        #countrylist .ui-selected {
            background: green;
            color: white;
        }

        #countrylist {
            list-style-type: none;
            margin: 0;
            padding: 0;
            width: 98%;
        }

        #countrylist li {
            margin: 3px;
            padding: 0.4em;
            font-size: 1.4em;
            height: 18px;
        }
    </style>
    <script>
        $(function () {
            $("#countrylist").selectable();
        });
    </script>
</head>
<body class="fontsize">
    <ul id="countrylist">
        <li class="ui-widget-content">India</li>
        <li class="ui-widget-content">America</li>
        <li class="ui-widget-content">Nepal</li>
        <li class="ui-widget-content">Pakistan</li>
        <li class="ui-widget-content">Itly</li>
    </ul>
</body>
</html>

 Now we have done run the application to check the output.


About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com
Email Id : contact@aspdotnet-pools.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Top jQuery Plugins

Global Classified : Connectseekers.com
© 2014
back to top