Quick and Dirty
A coworker wrote the following code. Quick and dirty, as they said, but this is beyond quick and dirty. It’s shamefully filthy even for a hack.
private void SetAccountHistoryTabActive(string acctId) {
// Use FindControl() !!!
foreach (Control control in Page.Controls) {
if (control is HtmlForm) {
foreach (Control control2 in control.Controls) {
if (control2 is AjaxControlToolkit.TabContainer) {
foreach (Control control3 in control2.Controls) {
if (control3 is AjaxControlToolkit.TabPanel && control3.ID == “Actions”) {
foreach (Control control4 in control3.Controls[0].Controls) {
if (control4 is AjaxControlToolkit.TabContainer) {
((AjaxControlToolkit.TabContainer)control4).ActiveTabIndex = 2;
foreach (Control control5 in control4.Controls) {
if (control5.ID == “ActionsAccountHistory”) {
foreach (Control control6 in control5.Controls[0].Controls[1].Controls[0].Controls) {
if (control6.ID == “AccountHistoryControl”) {
foreach (Control control7 in control6.Controls) {
if (control7.ID == “acctId”) {
string test = control7.ID;
((TextBox)control7).Text = acctId;
}
}
}
}
}
}
}
}
}
}
}
}
}
} // end of Controls loop
}
FWIW I replaced it with a line of javascript.
UPDATE: this person got fired
Michael said,
2007-09-01 at 9:13 pm
should’ve never let me see this site ’cause im going buck-wild on it…yes, quick and dirty could well define this colleague’s time there.