I am looking to format the datagridview so I can hide and format certain column headers. The problem is I cant use the built in winforms dgv formatting because I am filling the grid from a straight linq query and not binding the table with the built in wizard. Here is my code to fill the table. How can I format the headers on the grid? Thanks!
var search = from s in db.trips
orderby s.tripNo descending
select s;
dgvTripGrid.DataSource = search;
Create a dynamic entity with the column (header) names which should be displayed and bind it here is an example:
I show this example on my blog C# Linq How To Load a Winform Control Using Dynamic Linq entitites