Dear friends, good evening.
I have a method to fill clients by name in a datagridview this is my code:
public List<CLIENTES> GetClientesByNombre(string nombre)
{
using (RSAEntities db = new RSAEntities())
{
//return db.CLIENTES.ToList();
var Query = (from c in db.CLIENTES
where c.CLI_NOMBRE.StartsWith(nombre)
orderby c.CLI_NOMBRE
select c).ToList();
return Query;
}
}
in my form I am filling in the datagridview manually.
private void btnListar_Click(object sender, EventArgs e)
{
if (txtNombre.Text.ToString().Trim().Length==0)
{
MessageBox.Show("Ingrese un Nombre");
txtNombre.Focus();
}
else
{
NCliente nCliente = new NCliente();
List<CLIENTES> lista = new List<CLIENTES>();
lista = nCliente.GetClientesByNombre(txtNombre.Text.ToString().Trim());
dgvClientes.AutoGenerateColumns = false;
dgvClientes.DataSource = lista;
}
}
in design mode I handle the columns ejm
How do I show the GRU_NOMBRE field of the GROUP entity that is related to the CLIENT entity?
Thank you all for your valuable help.