protected void projectNumTB_TextChanged(object sender, EventArgs e) { if (projectNumTB.Text != string.Empty) { string numFormat = "[0-9]{2}[TBHKPDY]{1}[MFXE]{1}[0-9]{3}[A-Z]*"; // uppercase the letters if possible projectNumTB.Text = projectNumTB.Text.ToUpper(); // check to see if the project number follows the correct format if (Regex.IsMatch(projectNumTB.Text, numFormat)) { TimesheetManager tm = new TimesheetManager(); Project p = tm.getProjectForID(projectNumTB.Text.Trim()); classificationDDL.DataSource = tm.getClassificationForProject(projectNumTB.Text.Trim()); classificationDDL.DataBind(); classificationDDL.Items.Insert(0, "Select"); classificationDDL.Focus(); // if project is null get all classifications if (p != null) { projectNameTB.Text = p.ProjectName; clientNameTB.Text = p.ClientName; } else { projectNameTB.Text = " "; clientNameTB.Text = " "; // get all classifications if project was not matched classificationDDL.DataSource = tm.getClassifications(); classificationDDL.DataBind(); classificationDDL.Items.Insert(0, "Select"); } chargeableBtn.Visible = true; } else { TimesheetManager tm = new TimesheetManager(); // throw a dialog msg = "Project Number is not in Correct Format i.e: 11PM121(ABC)"; dialogTitle = "Project Number Format"; ScriptManager.RegisterStartupScript(this, this.GetType(), "projectNumInvalid", "throwDialog();", true); // get all classifications classificationDDL.DataSource = tm.getClassifications(); classificationDDL.DataBind(); classificationDDL.Items.Insert(0, "Select"); } // re-populate the dates ScriptManager.RegisterStartupScript(this, this.GetType(), "populate", "populate();", true); } }