Hi, change your code with my code:
At RowDataBound
TextBox txtInvDate = (TextBox)e.Row.FindControl("txtInvDate");
txtInvDate.Attributes.Add("onclick", "javascript:testJS('" + txtInvDate.ClientID + "');");
Write JS function(example)
function testJS(txtID)
{
var rowCount = document.getElementById('<%=grdCC.ClientID %>').rows.length;
var grdElement = document.getElementById('<%=grdCC.ClientID %>')
for (var i = 1; i < rowCount; i++) {
}
}