private void BtnSearch_Click(object sender, EventArgs e) { //if (String.IsNullOrEmpty(TxtSearch.Text)) //{ //MessageBox.Show("El campo 'Nombre de Rol' esta vacio."); //return; //} if (ChkSearchExact.Checked) { // Busqueda EXACTA Rol rol = _rolLogic.GetRolByNombre(TxtSearch.Text, true); _roles = new Dictionary <int, Rol>(); _roles.Add(rol.ID, rol); } else { // Busqueda LIKE _roles = _rolLogic.GetRolesByNombre(TxtSearch.Text, true).ToDictionary(p => p.ID, p => p); } var bind = _roles.Values.Select(a => new { ID = a.ID, Nombre = a.Name }); DgvRoles.DataSource = bind.ToList(); }