protected void btnSearch_Click(object sender, EventArgs e) { string searchValue = txtSearch.Text; if (!searchValue.Equals("")) { List <StaffDTO> searchResult = new List <StaffDTO>(); searchResult = dao.AdminSearchStaffByUsername(searchValue); Session.Add("AdminStaffSearch", searchResult); if (searchResult.Count() > 0) { lblMessage.Text = ""; gvStaffList.Visible = true; gvStaffList.DataSource = searchResult; gvStaffList.DataBind(); } else { gvStaffList.DataSource = null; gvStaffList.Visible = false; lblMessage.Text = "No record found!"; lblMessage.ForeColor = Color.Red; } } }