0

I have made a html table in asp.net. The user clicks on a row and the corresponding page for that record is opened. How do i know which row of the table has the user selected?

Seema
  • 107
  • 2
  • 5
  • 13

2 Answers2

0

http://www.electrictoolbox.com/jquey-make-entire-table-row-clickable/

$(document).ready(function() {

    $('#example tr').click(function() {
         alert('clicked');
    });

});

How to tell which row number is clicked in a table?

without jquery

Adding an onclick event to a table row

http://jsbin.com/ivobe

Community
  • 1
  • 1
adt
  • 4,320
  • 5
  • 35
  • 54
  • edited. example with pure js. But for the record jquery is worth learning – adt Apr 02 '13 at 19:34
  • actually what i want to do is to click on a row and open page with that records details. so i suppose i will have to save the details in a session variable? and how do i go to the next page using your above code? – Seema Apr 02 '13 at 20:02
  • open in new window with js, pass it with querystring – adt Apr 02 '13 at 20:07
0

try to set custom attribute of id to row(html) by assinging database id value to it. by clicking on that row , you can get access that custom attribute by $(this).attr('your_custom_attr') and you can use that value to make ajax GET call.

Niel_patel
  • 74
  • 8