单击DataGridView列标题时禁用排序

编程入门 行业动态 更新时间:2024-10-28 03:21:27
本文介绍了单击DataGridView列标题时禁用排序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个 DataGridView 列标题.当我单击该标题时,将根据该值重新计算数据.

I have a DataGridView column header. When I click that header, the data is resorted according to the value.

我不要.

DataGrid 具有 AllowSort 属性.DataGridView没有.我能做什么?

DataGrid has an AllowSort property. DataGridView doesn't have that. Anything I can do?

推荐答案

您可以覆盖OnColumnAdded函数:

You can override OnColumnAdded function:

protected override void OnColumnAdded(DataGridViewColumnEventArgs e) { base.OnColumnAdded(e); e.Column.SortMode = DataGridViewColumnSortMode.NotSortable; }

更多推荐

单击DataGridView列标题时禁用排序

本文发布于:2023-11-04 06:41:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1557220.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单击   标题   DataGridView

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!