I am trying to bind a filtered csv file to a datatable.
I use a Linq query to find selected fields (originaly from checkboxes).
Then I am using a foreach loop to load the query to a datadatbale.
Lastly bind to a gridview.
The problem I am having is carrying the column headings into a Gridview.
When I used ADO I could inherit the the first row with the headings.
With the following Linq code, I have to list each column.
There are over 200 fields and it causes me to do more data cleanup.
Is there a way to do this without having to list each field? Thanks
var FilterDetail = from FilterDetailTable in dTable10.AsEnumerable()
from filters in dTableFilters.AsEnumerable()
where (filters.Field<string>("FilterParm") == FilterDetailTable.Field<string>("Status"))
select FilterDetailTable;
foreach (var FilterDetailTable2 in FilterDetail)
{
dTable10_Filtered.ImportRow(
FilterDetailTable2
);
Did you enable auto generate columns on the grid?