Skip to main content

asp.net+Jquery : sort dropdownlist, sort all dropdown in the page

>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title> - jsFiddle demo</title>
  
  <script type='text/javascript' src='http://code.jquery.com/jquery-1.8.3.js'></script>
  
  
  

  <style type='text/css'>
    
  </style>
  


<script type='text/javascript'>
$(function(){
function sortDropDownListByText() {
    // Loop for each select element on the page.
    $("select").each(function() {
         
        // Keep track of the selected option.
        var selectedValue = $(this).val();
 
        // Sort all the options by text. I could easily sort these by val.
        $(this).html($("option", $(this)).sort(function(a, b) {
            return a.text == b.text ? 0 : a.text < b.text ? -1 : 1
        }));
 
        // Select one option.
        $(this).val(selectedValue);
    });
}

sortDropDownListByText();
});> 

</script>


</head>
<body>
  <select id="select_zone">
            <option value ="north">a</option>
            <option value ="east" >c</option>
            <option value ="south">d</option>
            <option value ="west">b</option>
</select>
  
</body>


</html>

Comments

Popular posts from this blog

SSL Certificate for IIS 8 in win 2012

                                                                       SSL How to create / import and configure self signed ssl certificate for IIS 8 in win 2012 Refer : http://www.youtube.com/watch?v=BYwOMuBDhPU http://www.entrust.net/knowledge-base/technote.cfm?tn=8713 1. Go to IIS 2. Select servername(TOP) 3. Middle area iis---->server certificate-->double click-->right side chosse & click created self certificate-->Specify a friendly name---> choose certificate type & click OK 4. Select site and right side BINDINGS--->Add-->Choose type https--->enter hostname and choose SSL cerificate---> ...

IIS 7 Tip # 5 Run a command when Rapid Fail Protection is triggered

Rapid-Fail Protection disables application pools if they crash multiple times within in a specified time period. This prevents the failing application pool from getting into a continuous loop of crashing and restarting. This protects other application pools running on the server as repeated failures can consume lot of system resources. When rapid-fail protection kicks in it stops the application pool that is repeatedly crashing and your clients will start getting a 503 – Service Unavailable error. An administrator will have to manually enable the application pool again. You also have to option to configure an executable to run when ever rapid-fail protection is triggered. For example below I have configured the application pool to restart the IIS service using iisreset.exe … the /rebootonerror will reboot the whole server if iisreset.exe for some reason fails to restart the services. Refer http://blogs.msdn.com/b/vijaysk/archive/2009/03/13/iis-7-tip-5-run-a-command-when-rapid-f...

How to add Microsoft Excel Application

Start Run mmc -32  or   DCOMCNFG -32 or dcomcnfg File Add Remove Snap-in Component Services Add OK Console Root Component Services Computers My Computer DCOM Config Microsoft Excel Application  Step to add:       Right click and select Properties->Select Identity Tab->Select This user and add the Administrator  accout and password  Select Security Tab, Under "Launch and Activation Permissions", Choose "Customize", Click "Edit" button, Add the everyone account and add all the Permissions        Do the same thing in "Access Permissions" and "Configuration Permissions".   Refer : http://journeytodotnetauthority.blogspot.in/2012/03/how-to-add-microsoft-excel-application.html