elle0087
elle0087

Reputation: 911

jquery sorting on asp.net

i m trying to apply the jquery sorting on a table in asp.net, but i have some problems. i tried on the base example and is not working. below my code:

base example

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

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>

        <link href="scripts/jquery.tablesorter/themes/blue/style.css" rel="stylesheet"/>    
        <script type="text/javascript" src="scripts/jquery-2.0.0.min.js"></script> 
        <script type="text/javascript" src="scripts/jquery.tablesorter/jquery.tablesorter.min.js"></script> 

    <script type="text/javascript">
        $(document).ready(function ()
        {
            alert("a")
            $("#myTable").tablesorter();
            alert("b")
        }
);
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <div>
            <table id="myTable" class="tablesorter"> 
                <thead> 
                    <tr> 
                        <th>Last Name</th> 
                        <th>First Name</th> 
                        <th>Email</th> 
                        <th>Due</th> 
                        <th>Web Site</th> 
                    </tr> 
                </thead> 
                <tbody> 
                    <tr> 
                        <td>Smith</td> 
                        <td>John</td> 
                        <td>[email protected]</td> 
                        <td>$50.00</td> 
                        <td>http://www.jsmith.com</td> 
                    </tr> 
                </tbody> 
            </table> 
        </div>
    </form>
</body>
</html>

what s wrong?

i checked the path, it s fine because css style is working...

Upvotes: 0

Views: 39

Answers (1)

too_cool
too_cool

Reputation: 1194

Works for me by simply writing the following (Order is important)

   $("#myTable").tablesorter();
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.29.0/css/theme.blue.css" rel="stylesheet"/>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tablesorter/2.29.0/js/jquery.tablesorter.min.js"></script>

<body>

  <div>
    <table id="myTable" class="tablesorter-blue">
      <thead>
        <tr>
          <th>Last Name</th>
          <th>First Name</th>
          <th>Email</th>
          <th>Due</th>
          <th>Web Site</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>Smith</td>
          <td>John</td>
          <td>[email protected]</td>
          <td>$50.00</td>
          <td>http://www.jsmith.com</td>
        </tr>
        <tr>
          <td>Bach</td>
          <td>Frank</td>
          <td>[email protected]</td>
          <td>$50.00</td>
          <td>http://www.frank.com</td>
        </tr>
        <tr>
          <td>Doe</td>
          <td>Jason</td>
          <td>[email protected]</td>
          <td>$100.00</td>
          <td>http://www.jdoe.com</td>
        </tr>
        <tr>
          <td>Conway</td>
          <td>Tim</td>
          <td>[email protected]</td>
          <td>$50.00</td>
          <td>http://www.timconway.com</td>
        </tr>
      </tbody>
    </table>
  </div>

</body>

Upvotes: 1

Related Questions