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. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GridFilterBar and refreshed datasource

Thread ID:





35219 Sep 26,2005 07:49 PM UTC Sep 29,2005 04:44 AM UTC WinForms 3
Tags: Tools
Asked On September 26, 2005 07:49 PM UTC

Hi, I''m working with a GridFilterBar on a GridDataBoundGrid and I went into a problem. Here is what I do: I use the list solely to list data from a datatable. I added several action to a usercontrol to manage the list. So, I have a button to add a new entry. Whenever I add a new entry, it shows up a new dialog to create a new item. When I come back, the list is then refreshed to reflect the database change. So basicaly, what I do is: myGrid.DataSource = some new DataTable And then I rewire the GridFilterBar to the GDBG. The problem is that right after this, the CUSTOM filter doesn''t work anymore. The window keep repoping up and nothing is filtered. So my question is: What''s the right way to refresh on the fly a GDBG ? Can I simply replace the DataSource or I need to recreate the whole object? Thanks

stanleyj [Syncfusion]
Replied On September 27, 2005 06:10 AM UTC

Hi Fred, If you are changing the datasource of the grid, before you rewire, call UnwireGrid and then after setting new datasource pass the grid in WiredGrid. Can you please upload your sample or modify this sample to reproduce the problem. Best regards, Stanley

Replied On September 27, 2005 02:54 PM UTC

Ok, I have not been able to reproduce exactly what it was doing, but here is what I did and that caused much problem: I was using the GridFilterBar as a local variable, so everytime I was refreshing the data, a new filter bar was created. Anyway, now I put the filter as a member of the class, it''s working now except for one thing. I was wondering if there was a way to keep the filter when refreshing data. The new datatable is identical to the last one in term of columns only some row change (like modified rows, added rows and deleted rows). Whenever I apply a custom filter on the datatable1, and then I refresh it to become datatable2 the custom filter doesn''t work unless I reset the filter for every row. Basicaly: 1- Load data 2- Apply custom filter 3- Refresh data with new datatable 4- Can''t apply custom filter 5- Reset the filter for that column 6- Reapply a custom filter So is there a way to reapply it automaticaly? Thanks a lot

Administrator [Syncfusion]
Replied On September 29, 2005 04:44 AM UTC

Hi Fred, Try using the RowFilter property to get and set the filter criteria. GridFilterBar filter; filter = new GridFilterBar(); filter.WireGrid(this.gridDataBoundGrid1); filter.FilterBarTextChanged += new GridFilterBarTextChangedEventHandler(filter_FilterBarTextChanged); string criteria; private void filter_FilterBarTextChanged(object sender, GridFilterBarTextChangedEventArgs e) { criteria = this.filter.RowFilter; this.label1.Text = criteria; // to view } // // After filling the modified datasource, wiring the filterbar set the Rowfilter // this.filter.RowFilter = criteria; Best regards, Stanley


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon