如何在排序中禁用数据网格中的最后一行或数据 [英] How to Disable the last row or data in the datagrid in Sorting

查看:86
本文介绍了如何在排序中禁用数据网格中的最后一行或数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好...

当用户要通过单击列标题进行排序时,如何禁用数据网格中的最后一行或最后一个数据.
我只希望最后一个数据始终在最后一行,因为它是数据的"TOTAL"或"AVERAGE"或"SUM".

请帮忙...

感谢高级..

Hello guys...

How can i disable the last row or the last data in the datagrid when the user wants to sort by clicking column header.
I just want the last data to be always in the last row, cause it is the "TOTAL" or "AVERAGE" or the "SUM" of the data.

Please help...

Thanks in advanced..

推荐答案

DataGridView1.DataSource = dt
DataGridView1.Rows(DataGridView1.RowsCount- 1).DefaultCellStyle.BackColor = Color.Gray
DataGridView1.Rows(DataGridView1.RowsCount-1).ReadOnly = True


我建​​议您使用datagrid的页脚模板作为总数和平均值.
I will suggest you to use footer template of datagrid for the total and average.


这篇关于如何在排序中禁用数据网格中的最后一行或数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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