Click here to Skip to main content
15,916,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i m trying to filter datagridview with this code but does not work
productsBindingSource1.Filter = String.Format("ProductName LIKE '{0}%' OR Barcode = '{0}' OR Comment LIKE '%{0}%'", txtSearch.Text);


datagridview source is productsBindingSource1
Can enyone tell why this does not work?
Posted
Comments
shakil0304003 23-Oct-10 3:17am    
What is your problem? Clear it?
thatraja 23-Oct-10 3:21am    
show us the error message, if any?
Sandeep Mewara 23-Oct-10 4:26am    
Update from OP:
it does not make any error or exeption. when i klick btnSearch it does not anything
Sandeep Mewara 23-Oct-10 4:28am    
Winforms or WebApp? You can post here as a comment...
Hiren solanki 23-Oct-10 4:39am    
To sandeep:
It seems ASP.Net as OP has mentioned datagridview , I think so.
To OP:
If you are not getting any error then have checked data ? are you binding filtered datasource to grid ? check deeply.

Check out the property BindingSource.SupportsFiltering and BindingSource.SupportsAdvancedSorting.

It would be no surprise that the data source simply doesn't support advanced filtering (multi-column filtering) or any filtering at all.

Have a look at the DataSource members for more info:
http://msdn.microsoft.com/en-us/library/ms158196%28v=VS.80%29.aspx[^]

Good luck!
 
Share this answer
 
Hi Lester,

Try the following link its will helpful to you.

Data Filter in DataGridView[^]


Cheers :)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900