I am currently working on a Windows App using C#. I have this datagridview whose first image columns are Edit and Delete. I have an issue with hiding both their headers. How can I do that, yet keep the headers of the following columns visible?
Thanks in advance.
While Using C# you can write the following
this.dataGridView1.Columns["CustomerID"].Visible = false;
and to Hide all the column headings you can use:
dataGridView1.ColumnHeadersVisible = false;
Select the datagridview and open property, there in property list you can set it to false like mentioned in screenshot .
In your filename.cs file you can add something like this..
dataGridView1.ColumnHeadersVisible = false;
in your filename.Designer.cs file you will have ..
this.dataGridView1.ColumnHeadersVisible = false;
For C# Winforms,
dataGridView1.ColumnHeadersVisible = false;
For asp.net (reader looking for a web solution)
dataGridView1.ShowHeader = false;
Hide all the column headers
dataGridView.ColumnHeadersVisible = false;
Hide specific column header
dataGridView.Columns[4].Name = "Delete"; //Add name you want
dataGridView.Columns[4].HeaderText = "";
I added a column name and then I put column header text as empty. But I able to work with column name if it is not visible. This is works for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.