"Performance matters," Bob was told on his first day. The company prided itself on using the latest, cutting-edge techniques, and emphasized the use of client-side code to keep the application responsive.
One day, while tracking down a JavaScript error, he got a very good picture of how their client-side code actually worked:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!string.IsNullOrEmpty(Request.QueryString["input"]))
{
SearchTextBox.Text = Request.QueryString["input"].ToString();
string script = "<script language=\"Javascript\">\r\n" +
"var searchImageButton = GetControl(\"SearchImageButton\", \"INPUT\");\r\n" +
"searchImageButton.click();" +
"\r\n</script>\r\n";
Page.ClientScript.RegisterStartupScript(typeof(Page), "CheckEnterPressed", script);
}
Search("");
}
}
protected void SearchImageButton_Click(object sender, ImageClickEventArgs e)
{
Search(SearchTextBox.Text);
}
private void Search(string searchString)
{
… //Do the actual searching
}