hello,
i have a templatecolumn containing a checkbox as its celltemplate in the grid. i add rows to this grid on the client. while adding rows, when i am at this templatecolumn cell i do - ele=row.getCell(3).Element; $addHandler(ele,"click",SelectRow); . the SelectRow function expects the checkbox object as its parameter, so that to check whether the checkbox is checked or unchecked. but it seems that i get some other object other that the checkbox in the SelectRow when it is invoked. i tried ele=row.getCell(3).Element.children[0] too.
regards,
Hello,
In this case SelectRow most probably receives as a parameter the Element of the cell which is a <td> element. I can suggest going down from this element and using
getElementsByTagName("INPUT")[0]
to get the first checkbox, or directly hooking the event on the checkbox in the template, e.g
<CellTemplate>
<input type="checkbox" onclick="SelectRow()" .. />
</CellTemplate>
this way, the reserved keyword "this" will have the instance of the checkbox inside the event handler.
Hope this helps.
i tried using getElementsByTagName("INPUT")[0] with the object paramerter that i receive in SelectRow handler but it gave me the error as "object doesnt support this property or method". it doesnt support object.id too.i do not understand what kind of object i get in it.
as i do not understand the object i receive, i cannot get the row from it. i just want to somehow traverse the whole row to checkout the other checkboxes in the same row.
i tried the above code too but it doesnt work, i think because the rows in that grid are added on the client with javascript. this is why i resorted to $addHandler() for the cell element but it gives me the problem which i have mentioned earlier.
regards