How to call javascript for gridview?

Posted by Oswaldlily under ASP.NET on 8/1/2012 | Points: 10 | Views : 1463 | Status : [Member] | Replies : 1
In javascript file I has

(highlight when hover over fields)
$(document).ready(function () {

$("#divGridView table tbody tr").mouseover(function () {

$(this).addClass("highlightRow");

}).mouseout(function () { $(this).removeClass('highlightRow'); })

});

I drag and used under content page..
Now i want this javascript for my gridview.how to call?
<div class="????">
<asp:gridview....></gridview>
</div">




Responses

Posted by: Ogipansrk on: 8/2/2012 [Member] Starter | Points: 25

Up
0
Down
Step1: Drag and Drop Jquery Library on your page;

Step2: Add the below code to your page in javascript

$(document).ready(function () {
$("#<%=GridView1.ClientID%> tr:has(td)").hover(function () {
$(this).css("background-color", "Lightgrey");
}, function () {
$(this).css("background-color", "#ffffff");
});
});

Just run your app.


Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response