in Q22752, you state that we can create column filters on a GridView at design time using the popup menu item on the column. When I try this, I see the filter in the design time view, but when I run the program there is no filter. I don't believe that the designer source code is affected as I just tried it again when the source was locked and no files were checked out nor were any files marked as being dirty, nor were there any errors. As far as I can see there is no side effects to adding a column filter as design time (maybe I am doing something wrong).
I have attached the project I was working on (which was a user interface prototype). I was trying to add a filter that would hide rows with the "Resolution State" set to "Auto-Resolve".
Steps to Reproduce:
- Open the attached project and open the ConflictResolutionForm in design mode.
- Right click on the "ResolutionState" column to open the context menu and select the "Filter Editor" item.
- Create a filter of the type "Resolution State" does not equal "Auto-Resolve".
- You should see the filter in the footer of the grid view. Run the application. You will see the Auto-Resolve row in the grid view, but the filter is empty. If you add the filter descibed above at run time, it does hide the "Auto-Resolve" row.
Actual Results:
As far as I can see not design source code is added and there are no side effects to adding a filter at design time.
Expected Results:
I would like to be able to add a filter to the Grid veiw at design time as stated in Q22752.
Hello Paul,
Thank you for the report. Our developers have researched this problem and come to the conclusion that this behavior is by design. The current XtraGrid's architecture doesn't allow the active filter to be serialized at design-time, because it is necessary to refresh the grid after its data source is assigned. To resolve the problem, you should handle the Form's Load event and programmatically adjust the filter as shown below:
this.conflictsGridView.ActiveFilterString = "[ResolutionState] <> 3";
Please try this solution and inform us of your results.
Thanks,
Stan.
Does this superseed the information given in Q22752? That is, is my case special or is not possible to assign filters to XtraGrid at run time?
I am sure that this solution you give is adequate.
Hello Paul,
There is no any spatial in your case. The filtering at design time is a bad approach and I don't recommend you to use it. We'll try to find a solution, however the best way to resolve this issue is to apply filter at runtime.
Thanks,
Stan.