i am develop the hospital project in C#.net[3.5 Framework].i show the non occupied beds in DataGriedView. i have use
dataGridView1.Sort(dataGridView1.Columns[0], ListSortDirection.Ascending);
above code.but DataGriedView data not arrange in ascending order.please help me... very urgent
Ramesh GPosted Mar 11, 2011, 10:32 AM
Jaganathan BantheswaranPosted Mar 1, 2011, 10:07 AM
Try like this example.
private void button2_Click(object sender, EventArgs e)
{
XmlDataDocument xmlDatadoc = new XmlDataDocument();
xmlDatadoc.DataSet.ReadXml("C:\\books.xml");
DataSet ds = new DataSet("Books DataSet");
ds = xmlDatadoc.DataSet;
DataView myDataView = ds.Tables[0].DefaultView;
myDataView.Sort = "PublicationYear ASC";
dataGridView1.DataSource = myDataView;
}
For more details visit http://www.c-sharpcorner.com/UploadFile/prathore/1567/