protected void ShowView(int row) { this.PeopleNoneForm.Visible = false; this.PeopleFriendsForm.Visible = false; this.PeopleVolunteersForm.Visible = false; this.PeopleBothForm.Visible = false; if (this.ProfilesGrid.SelectedIndex >= 0) { // then set one form to visible according to LetterCode clseditmode.editmode = true; clseditmode.firstload = true; string letterCode = ProfilesGrid.SelectedDataKey.Values["LetterCode"].ToString(); FormView currentForm = new FormView() ; //this.PersonType = Convert.ToChar(letterCode); //ViewState["PersonType"] = this.PersonType; switch (letterCode) { case "B": case "G": this.PeopleFriendsForm.Visible = true; currentForm = this.PeopleFriendsForm; break; case "M": case "V": this.PeopleVolunteersForm.Visible = true; //this.PeopleVolunteersForm.Row.Focus(); currentForm = this.PeopleVolunteersForm; break; case "O": case "W": this.PeopleBothForm.Visible = true; //this.PeopleBothForm.Row.Focus(); currentForm = this.PeopleBothForm; break; case "N": case "A": this.PeopleNoneForm.Visible = true; //this.PeopleNoneForm.Row.FindControl("txtFirstName"); currentForm = this.PeopleNoneForm; break; } TextBox txt = currentForm.Row.FindControl("txtFirstName") as TextBox; if (txt != null) txt.Focus(); else currentForm.Row.Focus(); //this.ProfilesGrid.Style.Add("display", "none"); } }So, as you see, I wanted to save some typing and instead of calling each individual form FindControl method have it outside the case switch loop. Not a bit deal to have it repeated, though.