I have an XML file that is displayed on a DataGridView driven by a dataset. I am having trouble setting up a filter where a user can enter information in a textBox then have the DataGridView filter to find results.
The XML File is displayed on the DataGridView using this method:
XmlDataDocument xmlDatadoc = new XmlDataDocument();
//Opens XML file from directory
xmlDatadoc.DataSet.ReadXml(txtDirectory.Text);
DataSet ds = new DataSet("TestXML DataSet");
ds = xmlDatadoc.DataSet;
dataGridView1.DataSource = ds.DefaultViewManager;
//XML Element displayed on DataGridView
dataGridView1.DataMember = "TestElement";
In the past I was successful in filtering through a DataGridView using the BindingSource.Filter method, for example:
BindingSource.Filter = string.Format("Name Like '" + txtName.Text) + "*'";
Since I do not have a binding source here, what other method can I use to accomplish filtering. Can I setup a binding source and use my previous method? If so, how?
Any help would be appreciated. Thanks!