I am trying to bring the table out of the database to the DataGridView, so that the columns would be called differently, not like in the database

DataClassesDataContext db = new DataClassesDataContext(); var Orders = db.Orders .Select(x => new { FullName = x.Clients.fullName }) .ToList(); dgvOrders.DataSource = Orders; 

enter image description here

How to make that instead of FullName displayed "name"?

  • 2
    new { FullName = x.Clients.fullName } - here you can just rename it, which is an anonymous class. - Monk

1 answer 1

May not quite understand what you want, but like this:

 dgvOrders.Columns[0].HeaderText="ФИО"; 
  • Yes, but I think that you can somehow use the attributes to set the name of the column? - Pavel
  • I'll be home, I'll try. And you did not try the option Monk'a? new { ФИО= x.Clients.fullName } - xSx
  • one
    In principle, I would have done so, but if not just the "FIO", but something with the spaces of the "FIRST Name of the Client" - Pavel