冻结DataGridView中的第一行 [英] Freeze First Row In DataGridView

查看:200
本文介绍了冻结DataGridView中的第一行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码是这样的,

 DataGridViewRow row =  new  DataGridViewRow {Frozen =  true }; 
dgvReports.Rows.Add(row);
dgvReports.Rows [ 0 ]。单元格[ 0 ]。值= 付费方式;
dgvReports.Rows [ 0 ]。单元格[ 1 ]。值= NET AMOUNT;



当我将一些数据添加到我的网格中时,垂直滚动条显示并且我的第一行不会变成

冻结。请给我一个解决方案。

解决方案

参考这个



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 的[<一个HREF =http://www.vbknowledgebase.com/?Id=91&Desc=Freeze-GridView-Columns-and-Head ers-in-ASP.Net-CSStarget =_ blanktitle =New Window> ^ ]



我希望它有所帮助。 :)

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. :)


这篇关于冻结DataGridView中的第一行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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