user3264676 user3264676 - 1 year ago 98
Javascript Question

How to get Column Value for a given Row within GridView using javascript in

I have a GridView, I have a row index in a javascript function. Now I want to get the value of a Column for that index in a GridView using javascript.
Please tell me how can I do this?

Answer Source

Check this out...

 var tbl = document.getElementById('Gridview1');

 var tbl_row = tbl.rows[parseInt(RowIndex) + 1];

 var tbl_Cell = tbl_row.cells[no of the cell];

 var value= tbl_Cell.innerHTML.toString();

Here no of the cell indicates the column number.

If it is a template field,you can try this..

var value=document.getElementById('GridViewId_ColumnID_' + RowIndex).value;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download