Click here to Skip to main content
15,908,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
if (query == null)
               {
                   //clear the filter if exisits begin
                   System.ComponentModel.ICollectionView view
                       = System.Windows.Data.CollectionViewSource.GetDefaultView(dataGrid.ItemsSource);
                   if (view != null) view.Filter = null;
                   //clear the filter if exisits end

                   query = new QueryController();
                   DataGridExtensions.SetDataGridFilterQueryController(dataGrid, query);
               }
Posted
Updated 12-Aug-14 20:50pm
v3
Comments
Herman<T>.Instance 13-Aug-14 5:17am    
the filter is a String so: view.Filter = "";
ZurdoDev 13-Aug-14 9:57am    
You should likely post as a solution.
ZurdoDev 13-Aug-14 9:57am    
The actual error would be a big help.
Herman<T>.Instance 13-Aug-14 9:59am    
true!

1 solution

What I do is if Null then string.Empty coming from the database and reverse it going back Param=null when it is string.empty. For numbers I do the same concept with the .MinValue function.
Within the stored procedure I do the following withing the where clause.
Where (@stringParam is null or column = '%' + @stringParam + '%')
 
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