I have a datagrid, its datasource is a dataview. There is a textbox with which users can type in filter text. I want to make the filter to be case insensitive. say, the typed text is "Tg"
I tried this
Mydataview.RowFilter = "UPPER(COL) LIKE '%TG%'"
but this gives me an invalidoperation exception
then I changed it to
Mydataview.RowFilter = "COL LIKE '%tg%' or COL LIKE '%TG%'"
This works but it does not cover all cases. Eg If a row is "Tg", it will be filtered out which is not desirable. What I want, when users type "Tg", it will match any data with tg, Tg, TG, tG, all the combination
thanks
RowFilter
obeys dataset CaseSensitive
value
So do this in your Form_Load method:
CaseSensitive
is set to False
by default
mydataset.CaseSensitive = false
Proof of concept:
选择名称两次,其中一个名为upper(name)作为finder,然后使用该列(不可见)过滤行
What if you have several columns that might be filtered? Use the option stated in the accepted answer.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.