Adding event based on the existing event of each row in the data grid
<p>If I got an event on each row of grid. For instance expand and collapse. Which works mainly on the key word this.SomeClass.row.Hide(). So when the user hits the image to expand and collapse it works.</p>

<blockquote>
  <p>Now the user asks for a new requirement as expand all and collapse
  all.</p>
</blockquote>

<p>This will be on top of the grid. but the when I iterate how to make sure the value of this is replaced by right object. </p>

<p>Any clue or direction that I need to follow. I use firebug or IE developer to check the value of this at any given instance.</p>

<p>Thanks</p>

<p>As suggested Adding the code snippet</p>

<pre><code>$(function () {
     ExceptionGrid.selectorId = "#ExceptionGridView";
                $(ExceptionGrid.selectorId + " td").live("click", handleCellClick);
                $(ExceptionGrid.selectorId + " td").live("dblclick", handleCellClick);
}

function handleCellClick(e) {
    if (!e) e = window.event;
    //find row and column index 
    var col = $(this).parent().children().index($(this));
    var row = $(this).parent().parent().children().index($(this).parent());

 var projectExpandCollapseIndex = 8;
    //*******
    //some logic that might change value of  projectExpandCollapseIndex 
    //*******

 if ($(this).closest("tr").find("td:nth-child(" + projectExpandCollapseIndex + ")")[0].className.indexOf("expand") == 0) {
                            //window.event.srcElement.className = "collapse";
                            $(this).closest("tr").find("td:nth-child(" + projectExpandCollapseIndex + ")")[0].className = 'collapse';
                        }
                        else {
                            //window.event.srcElement.className = "expand";
                            $(this).closest("tr").find("td:nth-child(" + projectExpandCollapseIndex + ")")[0].className = 'expand';
                        }
}
</code></pre>
