public void LoadTKNV(string tk) { BUS_NhanVien busNV = new BUS_NhanVien(); DataTable dt = new DataTable(); gvNhanVien.DataSourceID = null; // string.Empty can also used if (string.IsNullOrEmpty(tk) || string.IsNullOrWhiteSpace(tk)) { dt = busNV.DanhSachNhanVien(); if (dt == null) { dt = new DataTable(); } } else { dt = busNV.DanhSachTimKiem(tk); //if(gvNhanVien.RowCount == null) //{ //} } gvNhanVien.DataSource = dt.DefaultView; gvNhanVien.DataBind(); }
protected void btn_timkiem_Click(object sender, EventArgs e) { string timkiem = txt_timkiem.Text; BUS_NhanVien busNV = new BUS_NhanVien(); busNV.DanhSachTimKiem(timkiem); if (busNV.DemTK(timkiem) == 0) { lbltb.Text = "Không có dữ liệu cần tìm kiếm"; } gvNhanVien.EditIndex = -1; LoadTKNV(timkiem); }