Click here to Skip to main content
15,905,068 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My .aspx page contains a grid view with id="gridview1". It is a bounded grid view and placed inside a update panel it contains a template field with check box.
I would like to highlight rows in grid view as the mouse move moves over the grid and want to change color of grid row when the check box is clicked.
ASP.NET
<asp:GridView ID="GridView1" runat="server"  AutoGenerateColumns="False" BorderWidth="0px" CellPadding="0" CellSpacing="1"                                                             DataKeyNames="Cr_rowid" ForeColor="#333333" GridLines="None"                                                             ShowFooter="True" Width="16px">
                                                            <RowStyle BackColor="#FFFBD6" ForeColor="#333333" HorizontalAlign="Center" />
                                                            <Columns>
<asp:BoundField DataField="Slno" HeaderText="SlNo" />
                                                                <asp:BoundField DataField="Accessory_code" HeaderText="Code" />
    <asp:BoundField DataField="QtyNeeded" HeaderText="QtyNeeded" />
                                                                <asp:TemplateField HeaderText="Select">
                                                                    <ItemTemplate>
                                                                        <asp:CheckBox ID="chk_select" runat="server" AutoPostBack="True" 
                                                                            oncheckedchanged="chk_select_CheckedChanged" />
                                                                    </ItemTemplate>
 </asp:TemplateField>
                                                            </Columns>                                                            
</asp:GridView>

I have tried this code inside onDocumentReady() and then inside pageLoad() but both do not work.

How can I access row of grid view at client side.

JavaScript
$('#GridView1 tr:has(td)').mouseover(function() {
$(this).addClass('highlightRow');
});
$('#GridView1 tr').mouseout(function() {
$(this).removeClass('highlightRow');
})
Posted
Updated 3-Dec-12 22:16pm
v2

1 solution

 
Share this answer
 
Comments
rajin kp 7-Dec-12 2:08am    
thanks Krunal Rohit

Icheck this It can acees each row but My code addClass('classname') does not work with my gridview
[no name] 12-Dec-12 5:32am    
post your question with code.. we'll help ya :)

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