Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a List of data holder
IList<dataholder> dataList = new List<dataholder>();

dataList = GetDataList();
datagridview1.dataSource = datalist;
</dataholder></dataholder>


from the above code i am able to set my datasource with the dataholder class properties as the column header

I have an array of string with custom column headers text..
How can i keep this array values as my DataGridview column header text even after setting the data source
Posted

Perhaps set DataGridView.AutoGenerateColumns to false.
 
Share this answer
 
i got the solution
it can be achieved by adding the column headertext after setting datasource

like below
dataPreviewDataGridView.Columns[colNo].HeaderText = columnName;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900