Problem: How can I reorder columns in a data table?
Solution: Columns in datatable can be reordered using SetOrdinal method of datatable.
Here is an example code:
Solution: Columns in datatable can be reordered using SetOrdinal method of datatable.
Here is an example code:
DataTable dt = new
DataTable();
dt = lst.GetDataTable();
dt.Columns["bank"].SetOrdinal(6);
dt.Columns["remarks"].SetOrdinal(dt.Columns.Count
- 1);
Here "bank" column will be set at position 6 and "remarks" column at last of all columns in the table.
Hope this small tips will be helpful.
Great Article
ReplyDeleteCyber Security Projects for CSE Students
Project Centers in Chennai
JavaScript Training in Chennai
JavaScript Training in Chennai