简体   繁体   English

C#中的gridview搜索和分页

[英]gridview search and paging in C#

how can I search in a gridview and just show the result with paging in it instead of whole data in gridview? 如何在gridview中搜索并仅在其中显示分页而不是在gridview中显示整个数据的结果?

I wrote this code to search: 我编写了以下代码进行搜索:

foreach (DataGridViewRow row in Reserve_dataGridView.Rows)
        {
            if (row.Cells["Cardserial"].Value.ToString().Equals(textBox1.Text))
            {
                Reserve_dataGridView.Rows[row.Index].DefaultCellStyle.BackColor = Color.Yellow;
            }

There's a simple answer by Rick Mohr on how to do this using BindingNavigator and BindingSource . 关于如何使用BindingNavigatorBindingSource做到这一点,Rick Mohr有一个简单的答案

You may also want to look at some other articles/implementations on CodeProject. 您可能还需要查看CodeProject上的其他文章/实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM