I have a rad grid with a template column. The template column contains a div element which I use as a toggle to show/hide some content. I set the onclick attribute for the div tag in the grid's ItemDatabound event. The div tag's clientId is passed to the following javascript function and I have domething along the lines of :
When the page first loads and the grid is bound, everything works fine. Clicking on the div runs the javascript funciton and it does it's work. However, if I update the page with Ajax (the grid doesn't get rebound), then I get a null reference for the div within the javascript function. It would seem that the ajax update is changing the DOM structure of the page and since the grid isn't rebound, the Client ID which is passed to the javascript function is no longer valid.
So... is there a way to modify my javascript function to take this change into account?
function toggleOfferItem_CSOC(divClientId) |
{ |
var div = document.getElementById(divClientId); // this is null after ajax update |
} |
When the page first loads and the grid is bound, everything works fine. Clicking on the div runs the javascript funciton and it does it's work. However, if I update the page with Ajax (the grid doesn't get rebound), then I get a null reference for the div within the javascript function. It would seem that the ajax update is changing the DOM structure of the page and since the grid isn't rebound, the Client ID which is passed to the javascript function is no longer valid.
So... is there a way to modify my javascript function to take this change into account?