I am implementing a feature in a project using ASP.NET MVC and I'm trying to remove some columns from a gridview that I created in my application, the gridview datasource is a table in the database, however I want to remove some columns from the table , since I am trying to export this data to an excel file and some table items as the primary key are not required. How do I remove columns from my choice of gridview? I've tried things like:
gv.Columns.Remove("ArquivoExcelId");
I also tried:
gv.Columns[0].Visible = false;
But the 2 generated error, as if the past parameters were incompatible or something, does anyone know how to do this?