Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Can anyone tell me what's wrong with my code.

Here,Document Ready function is not working.

<%@ Page Theme="SkinFile"  Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script src="Scripts/jquery-1.4.3.min.js" type="text/javascript">

        $(document).ready(function ()
        {
            $('#<%= GridView1.ClientID %> tbody tr').mouseover(function()
            {
                $(this).addClass('highlightRow');
            }).mouseout(function ()
            {
                $(this).removeClass('highlightRow');
            }).click(function ()
            {
                $(this).toggleClass('selectedRow');
            });

        }); 
        
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:GridView ID="GridView1" runat="server" BackColor="White"  Font-Size="10" Font-Names="Verdana" 
            BorderColor="#000000" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" 
            Width="400px" CellSpacing="0" GridLines="Horizontal" SkinID="gridviewSkin" >
        </asp:GridView>
</asp:Content>

Thanks in Advance.
Posted
Updated 18-Oct-14 3:32am
v2
Comments
[no name] 18-Oct-14 12:51pm    
What is the console error you are getting..please try putting the script at the end of the page..this should work out,..
Thanks

1 solution

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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