Manipulate GridView Rows, Cells, Cell Controls from JavaScript
Posted by kinjanshah on September 26, 2008
In one of the functionalities I was developing, I needed to integrate my GridView with JavaScript. I mean I was supposed to change the text in few cells of GridView. So, I dig it little bit and found out a way as I have shown below.
Accessing GridView rows/cells from JavaScript:
<script type=”text/javascript” language=”javascript”>
tblTable=document.getElementById(‘<<Client ID of the GridView>>’);
Cell=tblTable.rows[0].cells[0];
Cell.innerHTML=’Hurra!!!!! I have accessed the first row, first cell’;
</script>
Accessing GridView Rows/cells and Cell Control from JavaScript:
Isn’t it a great way to access GridView from JavaScript?
<script type=”text/javascript”>
tblTable=document.getElementById(‘<<Client ID of the GridView>>’);
Cell=tblTable.rows[0].cells[0];
FirstControl = Cell.childNodes[0];
</script>
Hope this will help you out.