DataTable.rowFilter问题 [英] DataTable.rowFilter Issue

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

问题描述

嗨大家好,


我有一个textBox和一个DataGrid,它有一个到DataTable的bindingSource。


目前,当你要输入文本框,dataTables过滤器会发生变化,只有结果才会显示文本框文本出现在数据表的某个字段中的位置。


第1行Alan Smith


第2行Calum Johnson


第3行John Brown


第4行Zander Black


例如,如果我输入"John",则只有第2行和第3行(按此顺序)可见grid。


客户端已要求更改此行为。现在他想要改变订单,以便"以...开头"的名称"约翰"首先出现在网格中,然后是"包含"的行。 "约翰" ;.例如,显示第3行,然后显示第2行。


这是否可以使用rowfilter属性?


John








jppnn

解决方案

使用一行代码并更改如何过滤以下组件需要两行代码来实现。包含,开头,结尾和等于是支持加上如果它没有做你想要的有关如何自定义
组件的说明。


https://www.codeproject.com/Articles/33786/DataGridView-Filter-Popup



Hi folks,

I have a textBox and a DataGrid that has a bindingSource to a DataTable.

Currently, when you being to type into the textbox, the dataTables filter changes so that only results show where the text of the textbox appears within one of the fields of the datatable.

Row 1 Alan Smith

Row 2 Calum Johnson

Row 3 John Brown

Row 4 Zander Black

eg If I type in "John", Only rows 2 and 3 (in that order) will be visible on the grid.

The client has asked for a change in this behavior. Now he wants the order changed so that names that "begin with" "John" appear first in the grid followed rows that "contain" "John". eg display row 3 then row 2 underneath.

Is this possible using rowfilter property?

John


jppnn

解决方案

With one line of code and a change in how you are filtering the following component requires two line of code to implement. Contains, starts with, ends with and equals are support plus if it does not do what you want there are instructions on how to customize the component.

https://www.codeproject.com/Articles/33786/DataGridView-Filter-Popup


这篇关于DataTable.rowFilter问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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