Any of u please help to fill my DataGridView.
It is Windows application using C#.
I need to fill my DataGridView from an XML depends on particular search criteria.
i did
DataSet.ReadXml(FileStream);
DataGridView.DataSource = DataSet;
In that manner how can i fill that grid in windows application.
i can't find DataBind() here.
Loading
Kirtan PatelPosted Oct 29, 2008, 4:41 AM
You Can Do this By Filling Data Into DataGridView Using Data set make object of data View and Filter data in DatGridView
using RowFilter
Here What i have coded for that
public void displaydatainGrid()
{
XmlDataDocument xmldatadoc = new XmlDataDocument();
xmldatadoc.DataSet.ReadXml("greets.xml");
ds = new DataSet();
ds = xmldatadoc.DataSet;
dataGridView1.DataSource = ds.Tables["vgreets"].DefaultView;
dv = new DataView();
//Filter Your Data By This Code Using Rowfilter
dv = ds.Tables["vgreets"].DefaultView;
dv.RowFilter = "greet_cat = 'Good Morning'";
}
Happy Coding :)
Ryan AlfordPosted Oct 29, 2008, 9:36 AM