Remove Columns from GridView

I have a GridView with several columns that I do not want to export to PDF (via iTextSharp).

How can I hide columns that I do not want to export before exporting data?

+4
source share
2 answers

Before exporting data, do the following:

myGridView.columns.RemoveAt(index); //Index is the index of the column you want to remove myGridView.Databind(); 
+7
source

or try

  dataGridView1.Columns[index].Visible = false; // the index of the column to be hidden 
+1
source

All Articles