Click here to Skip to main content
15,888,066 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
var bcol = new DataGridViewButtonColumn
           {
               HeaderText = @"Action",
               Text = "DoNotRTI",
               Name = "btnInsert",
               UseColumnTextForButtonValue = true,
               SortMode=DataGridViewColumnSortMode.NotSortable

           };

I have created button column using this code i need to
C#
disable the column header click event
Posted
Comments
Sergey Alexandrovich Kryukov 25-Jun-13 2:19am    
System.Windows.Forms? Tag: "WinForms".
—SA

Try with this

GridView1.HeaderRow.Cells[0].Enabled = false;
 
Share this answer
 
Comments
asadbek nabijonov 29-Mar-23 5:11am    
i cannot find "HeaderRow" method
Don't subscribe any method to the event. That way clicking on it won't have any consequences.
 
Share this answer
 
Comments
Member 9977421 25-Jun-13 2:58am    
but i still Does n't subscribe any method to the event.only given in button click.
lukeer 25-Jun-13 4:18am    
So you're after the built-in sorting? Then my solution is no good. Refer to Mukesh Ghosh instead.

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