We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Error while applying filter

Hi I have a grid consists of Filterbar.I have written a code in "fbFilter_FilterBarTextChanged" to store the applied filter and used Datagrid Default view to apply filter. Now 1. Apply filter on a column. 2.Change the value in the column ,on which filter is applied, and click on any other cell. 3.The changes done are lost and an error is thrown,which i am not able to catch, and application shuts down. However if i am changing the value of any other column on filtered grid then no error is thrown and application works fine. Also application works fine if no filter is applied on grid. Can you help me for this.

7 Replies

AD Administrator Syncfusion Team October 4, 2004 11:32 AM UTC

Are you using version 2.1.0.9? There was a problem like this in an earlier version if you did not actually used a DataTable as your datasource (ie., maybe you use datasource=DataSet + datamember=tablename to specifiy the data source for the grid). You normally do not have to set the filter on the defaultview as the FilterBar should do this for you. What are trying to do this in the FilterBarTextChanged event?


AD Administrator Syncfusion Team October 4, 2004 12:10 PM UTC

Thanks for the reply. I am using version 1.6.Also i anot using datasource=DataSet + datamember=tablename In the event i am forming the filter string and applying it. Also i am attaching the Error message box bitmap file and the code which i have written in the Event. >Are you using version 2.1.0.9? There was a problem like this in an earlier version if you did not actually used a DataTable as your datasource (ie., maybe you use datasource=DataSet + datamember=tablename to specifiy the data source for the grid). > >You normally do not have to set the filter on the defaultview as the FilterBar should do this for you. What are trying to do this in the FilterBarTextChanged event? FilterGridError_5824.zip


AD Administrator Syncfusion Team October 4, 2004 12:49 PM UTC

The filterbar.FilterBarTextChanged event is strictly a noticification event. It does not give you the option of changing the filter that would be applied. Is this what you are trying to do? (If you upgrade to the 2.0 code base, there is more flexibility in how you can handle the filter string, including droping your own custom dialog if that is what you want to do.) It looks like you are trying to handle an existing filter that is not part of the FilterBar filtering? Is this case? This is not supported in the 1.6 grid. The 2.0 code base manages this. If you do not want to upgrade and own the 2.0 source code version, you can just include the code from from the 2.0 GridFilterBar class in your project to get this support. Is this why are you trying to handle the FilterBarTextChanged event?


KA Kanika October 5, 2004 05:20 AM UTC

Thanks for your suggestion. But what i am trying to do is: Application stores the fiterbar applied on the grid.When the user runs the application again then the filter applied during last seesion will be fetched and is applied on the grid.So I am applying this filter on grid in filterbar.FilterBarTextChanged event As suggested by you. I have moved the code in the filterbar.FilterApplied event.But the problem still presists. Can you suggest any appropriate approach for this. Also from where i can get the 2.0 version code. Thanks kanika >The filterbar.FilterBarTextChanged event is strictly a noticification event. It does not give you the option of changing the filter that would be applied. Is this what you are trying to do? (If you upgrade to the 2.0 code base, there is more flexibility in how you can handle the filter string, including droping your own custom dialog if that is what you want to do.) > >It looks like you are trying to handle an existing filter that is not part of the FilterBar filtering? Is this case? This is not supported in the 1.6 grid. The 2.0 code base manages this. If you do not want to upgrade and own the 2.0 source code version, you can just include the code from from the 2.0 GridFilterBar class in your project to get this support. > >Is this why are you trying to handle the FilterBarTextChanged event?


AD Administrator Syncfusion Team October 5, 2004 06:05 AM UTC

If you want to explicitly set the filter to something, then try just setting the RowFilter property. This should trigger the filter process. So, after you have wired the filterBar, try code like: string savedFilter = "[CustomerID] LIKE ''A*''"; this.theFilterBar.RowFilter = savedFilter;


AD Administrator Syncfusion Team October 5, 2004 07:22 AM UTC

Thanks .. I am following the same approach. But to save the filter string in the database, i am storing the filter applied in a variable in filter changed event. Also even if i remove this event the same error is coming. If it is only because of the version i am using then what can be the possible solution. Thanks >If you want to explicitly set the filter to something, then try just setting the RowFilter property. This should trigger the filter process. > >So, after you have wired the filterBar, try code like: > >string savedFilter = "[CustomerID] LIKE ''A*''"; >this.theFilterBar.RowFilter = savedFilter; >


AD Administrator Syncfusion Team October 5, 2004 07:38 AM UTC

Adding the 2 lines of code shown above in the FilterBarGrid sample shows the initial grid filtered as expected. If you try these lines in the FilterBarGrid sample, do things work for in that sample? If not, then maybe getting the latest relase will solve your problem. You can download the latest release for which you are licensed from your Direct Trac support home page. If it does work, then there may be something particular about what you are doing that is affecting this. If you can post a sample project showing the problem, I can try it with the latest code to see if it runs with the lastest code. If it does not, I can try to debug it to see what might be causing this problem.

Loader.
Live Chat Icon For mobile
Up arrow icon