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

GridFilterBar and refreshed datasource

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

3 Replies

ST stanleyj Syncfusion Team 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


FR Fred 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


AD Administrator Syncfusion Team 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

Loader.
Live Chat Icon For mobile
Up arrow icon