I have a datatable with one column that contain names.I want to load combobox with datatable such that names should be in alphabetic order for eg:first name starts with a. second name starts with b.How can i sort data in datatable.Can anybody help?
Use a DataView:
DataTable dt; //comes from somewhere...
DataView dv = new DataView(dt)
dv.Sort = "Name ASC";
foreach(DataRowView drv in dv)
//....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With