public void setControl(bool exist, string control, string type) { if (exist) { try { if (type == "LinkButton") { LinkButton link1 = (LinkButton)ControlFinder.FindControlRecursive(this, control); link1.Visible = true; } } catch (Exception ex) { } } else { try { if (type == "LinkButton") { LinkButton link1 = (LinkButton)ControlFinder.FindControlRecursive(this, control); if (link1 != null) { link1.Visible = false; } } } catch (Exception ex) { } } }