I know there are a good few threads on this topic but i have tried everything and still no luck filtering my datagridview. I am trying to filter the rows of a datagridview based on the value a user inputs in a text field. The datagridviews datasource is set du the datasource provided below.
So here is the code i am using. i get no errors, the datagridview simply does not change.
ManufacturerService.GettAll returns a List of Manufacturer, i convert it to a bindinglist to
bsManufacturers.DataSource = new BindingList<Manufacturer>(ManufacturerService.GetAll(_ctx));
On the textchanged event of the textbox this code runs. i have checked with breakpoints and so on. the code is executed ant the filter string is correct.
private void FilterData(string str)
{
bsManufacturers.Filter = string.Format("Name like '%{0}%'", str);
dgvManufacturers.Refresh();
}
Any help? or atleast an explanation of why this does not work? I have been working on this for a good few hours and just cant seem to find an anwser anywhere
I solved this problem by using this project:
http://blw.sourceforge.net/
Personally i think there should be a better way of doing this but it’s working now and i guess that i will have to be happy with “good enough” for now.
Here is the working code. The important parts anyway.