<script language="javascript" type="text/javascript"> var gridViewCtlId = '<%=ctlGridView.ClientID%>'; var gridViewCtl = null; var curSelRow = null; var curRowIdx = -1; function getGridViewControl() { if (null == gridViewCtl) { gridViewCtl = document.getElementById(gridViewCtlId); } } function onGridViewRowSelected(rowIdx) { var selRow = getSelectedRow(rowIdx); if (null != selRow) { curSelRow = selRow; var cellValue = getCellValue(rowIdx, 0); alert(cellValue); } } function getSelectedRow(rowIdx) { return getGridRow(rowIdx); } function getGridRow(rowIdx) { getGridViewControl(); if (null != gridViewCtl) { return gridViewCtl.rows[rowIdx]; } return null; } function getGridColumn(rowIdx, colIdx) { var gridRow = getGridRow(rowIdx); if (null != gridRow) { return gridRow.cells[colIdx]; } return null; } function getCellValue(rowIdx, colIdx) { var gridCell = getGridColumn(rowIdx, colIdx); if (null != gridCell) { return gridCell.innerText; } return null; } </script>
Wednesday, June 30, 2010
Function to Get GridView Row And Column through JavaScript
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment