How can I hide a specific Column in DataGridview
along with its header
while being able to use its value ? ( just doesn't get shown ) .
The following code doesn't work.
gridview.Rows[e.RowIndex].Cells[11].Visible = false;
The way to hide a column in a DataBound GridView is to trap the RowCreated Event and set a Cell inside the column of the row to Visible = false.
The DataGridView control provides a customizable table for displaying data. The DataGridView class allows customization of cells, rows, columns, and borders through the use of properties such as DefaultCellStyle, ColumnHeadersDefaultCellStyle, CellBorderStyle, and GridColor.
Try this:
gridview.Columns["ColumnName"].Visible = false;
Hide Columns in the Windows Forms DataGridView Control
This is 100% correct solution....
this.dataGridView1.Columns[0].Visible = false;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With