My function below is supposed to loop through each row in the table and return the index of the row for some reason it always "finds" the control in the first row which it is not a returns zero. I dont understand why its doing this behavior.
Code:
private int GetIndex(Control ctrl)
{
for (int i = 0; i < tblEmailList.Rows.Count; i++)
{
if (tblEmailList.Rows[i].FindControl(ctrl.ID) == ctrl)
{
return i;
}
}
return -1;
}