且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

冻结DataGridView中的第一行

更新时间:2023-02-05 19:30:58

参考这个



how-to-freeze-first-row-in-datagridview-when -using-a-custom-sortcomparer [ ^ ]



希望它会有所帮助..


我认为你希望gridview的标题是frezzed,它应该有名为pay of pay和Net amount的列。如果是这样,请检查以下链接:

first-column-of-gridview-control.aspx>冻结标题和第一列网格视图控件 [ ^ ]

Gridview with Fixed Header [ ^ ]



但是你也可以看一下这个链接:

冷冻的GridView-列 - 和 - 集管式-ASP.Net-CSS 的[ ^ ]



我希望它有所帮助。 :)

My Code is Like This,

DataGridViewRow row = new DataGridViewRow { Frozen = true };
dgvReports.Rows.Add(row);
dgvReports.Rows[0].Cells[0].Value = "MODE OF PAY";
dgvReports.Rows[0].Cells[1].Value = "NET AMOUNT";


when i added some datas into my grid , Vertical scrollbar displays and my first row dosen't become
freezed. Please give me a solution for this.

Refer this

how-to-freeze-first-row-in-datagridview-when-using-a-custom-sortcomparer[^]

Hope it will help..


I think you want the header of gridview to be frezzed which should have columns named "Mode of pay" and "Net amount". If so check these links:
freeze-header-and-the-first-column-of-the-gridview-control[^]
Gridview with Fixed Header[^]

However you may take a look at this link as well:
Freeze-GridView-Columns-and-Headers-in-ASP.Net-CSS[^]

I hope it helps. :)