单击DataGridView如何禁用列标题 [英] How to disable column heading is clicked of DataGridView

查看:76
本文介绍了单击DataGridView如何禁用列标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello

在DataGridView中单击列标题时,默认行为是根据单击的列对网格行进行排序。我需要禁用This..plz help

Hello
When a column heading is clicked in a DataGridView, the default behavior is to order the grid rows based on the clicked column.I need to disable This..plz help

推荐答案

试试这个



Try this

foreach (DataGridViewColumn column in dataGridView.Columns)
{
    column.SortMode = DataGridViewColumnSortMode.NotSortable;
}


我找到了解决方案



i found solutions

if (e.RowIndex >= 0)


检查这些..

http://stackoverflow.com/questions/4334983/best-way-to-disable- the-column-header-sorting-in-datagridview [ ^ ]

http://stackoverflow.com/questions/3965304/disable-datagridview-colum-header-to-allow-sorting [ ^ ]

http://stackoverflow.com/questions/4502442/how-to-disable-sort-in-datagridview [ ^ ]
Check these..
http://stackoverflow.com/questions/4334983/best-way-to-disable-the-column-header-sorting-in-datagridview[^]
http://stackoverflow.com/questions/3965304/disable-datagridview-colum-header-to-allow-sorting[^]
http://stackoverflow.com/questions/4502442/how-to-disable-sort-in-datagridview[^]


这篇关于单击DataGridView如何禁用列标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆