Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am trying to implement tablesorter jquery in my asp.net MVC 4 application. I am getting the following error "Microsoft JScript runtime error: Object doesn't support property or method 'tablesorter'". I have found similar issue posted on this site and i tried all the posible solutions found and spent around 2 days to figure it out but no luck.

Here is the code for your review:
<pre lang="xml">
<script type="text/javascript" src="../../Scripts/jquery-1.9.1.js"></script>
<script type="text/javascript" src="../../Scripts/jquery-latest.js"></script>
<script type="text/javascript" src="../../Scripts/jquery.metadata.js"></script>
<script type="text/javascript" src="../../Scripts/jquery.tablesorter.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $('#myTable1').tablesorter();
    });
</script>
@{
    ViewBag.Title = "SortedTable";
}
<h2>SortedTable</h2>
<table id="myTable1">
    <thead>
        <tr>
            <th>Emp ID</th>
            <th>Employee Name</th>
            <th>Designation</th>
            <th>Dept</th>
            <th>DOB</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>100</td>
            <td>Bob</td>
            <td>tech</td>
            <td>CS</td>
            <td>01-01-2005</td>
        </tr>
        <tr>
            <td>101</td>
            <td>Arnold</td>
            <td>tech</td>
            <td>CS</td>
            <td>01-01-2001</td>
        </tr>>
    </tbody>
</table>

could anyone please point me out whats wrong with the above code.
Posted
Updated 5-Jun-13 19:29pm
v2
Comments
Sunasara Imdadhusen 6-Jun-13 8:24am    
please try to put your javascript just before body close tag e.g. </body>
vbmike 10-Jun-13 19:00pm    
A quick look at the documentation for the script appears to say you also need a class of "tablesorter" added to the table element along with the id you have.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900