Introduction:
In this post, Find jQuery code to get Row Index and Column Index of ASP.NET GridView Cell on click or on mouseover event.
HTML
ID | Product Name | Quantity | Price |
---|---|---|---|
1 | Mouse | 10 | 100 |
2 | Speaker | 15 | 990 |
3 | Hard Drive | -35 | 3990 |
4 | RAM | 22 | 399 |
5 | Wireless Keyboard | 10 | 3500 |
6 | Wi-Fi Router | -1 | 3990 |
7 | LCD | 62 | 3000 |
8 | Intel Processor | -5 | 7000 |
9 | Monitor | 25 | 1990 |
10 | Keyboard | 20 | 350 |
JS:
$(document).ready(function () { $("#gdRows tr td").mouseenter(function () { $(this).css("cursor", "pointer"); var iColIndex = $(this).closest("tr td").prevAll("tr td").length; var iRowIndex = $(this).closest("tr").prevAll("tr").length; $('#spnResult').html("Row: " + iRowIndex + " and column: " + iColIndex + ""); }); });
0 comments :
Post a Comment