重新排列数据网格视图行 [英] ReArrange Data Gridview Rows
本文介绍了重新排列数据网格视图行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个50行的datagredview,在网格上进行搜索,并希望在顶部设置该特定行。
i have a datagredview with 50 rows , make search on grid and want to set that particular row on the top.
For Each dr As DataGridViewRow In DGAccount.Rows
If dr.Cells(3).Value = txtAcID.Text.Trim Then
dr.Selected = True
DGAccount.FirstDisplayedScrollingRowIndex = dr.Index
DGAccount.CurrentCell = dr.Cells(3)
DGAccount.Update()
Exit For
End If
Next
任何人都可以帮助我我可以重新排列数据网格。
谢谢
Can any body help me how can i rearrange datagrid .
Thanks
推荐答案
请搜索数据表,而不是搜索网格被绑定到网格。您将能够更快地过滤记录。将过滤后的记录传输到另一个数据表,并将新数据表绑定到网格。通过这种方式,您可以轻松搜索网格...
我假设您正在使用网络应用程序
Instead of searching the grid, please search the datatable that is bound to the grid. You will be able to filter the record faster. Transfer the filtered records to another datatable and bind the new datatable to the grid. This way it will be easy for you rather than searching the grid...
I assume you are working in a web application
Dim dr() as DataRow
Dim dt1 as DataTable
dt1=dt.clone()
dr=dt.Select(" AccountID='" & txtAcId.Text.Trim &"'")
for each dr1 as DataRow in dr
dt1.ImportRow(dr1)
next
DGAccount.DataSource = dt1
DGAccount.DataBind()
希望它有所帮助!!
用餐h Kumar V
Hope it helps!!
Dinesh Kumar V
这篇关于重新排列数据网格视图行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文