Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search for a control

Status
Not open for further replies.

MrCSharp

IS-IT--Management
Jun 7, 2005
59
CA
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;
    }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top