Delete Columns from GridView

一个人想着一个人 提交于 2020-01-22 21:09:07

问题


I have a GridView with a couple of columns that I do not want to be exported to PDF (through iTextSharp).

How can I hide the columns I don't want exported before I export the data?


回答1:


Before exporting the data, do something like:

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



回答2:


or try

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


来源:https://stackoverflow.com/questions/1215996/delete-columns-from-gridview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!