protected void btn_search_Click( object sender, EventArgs e ) { try { //defaultstatus(); string input = this.txtbox_search.Text.ToString(); BusinessTier.Admin admin = new BusinessTier.Admin(); Data.DataBase.patientsDataTable table = new Data.DataBase.patientsDataTable(); if ( input.Length > 0 ) { table = admin.SearchPatientByID(input); if ( table.Rows.Count > 0 ) { this.gv_patientview.DataSource = table; this.gv_patientview.DataBind(); } else { this.lbl_searchwarning.Text = "Invalid ID, Please confirm the IDs before search..."; this.lbl_searchwarning.BackColor = System.Drawing.Color.Red; } } else { table = admin.SelectAllPatients(); this.gv_patientview.DataSource = table; this.gv_patientview.DataBind(); } } catch ( Exception ex ) { this.lbl_searchwarning.Text = ex.Message; } }