How To Sort DataTable In C# Or VB.NET
Sorting a data table before binding to a data control like gridview or datalist is provided by microsoft through it's predefined methods which is defaultview.sort.
Example:
Where dt1 is your datatable. Or you could create a dataview object as provided by MSDN.
Source: MSDN
Example:
//C# dt1.DefaultView.Sort = "Name Desc"; //VB.NET dt1.DefaultView.Sort = "Name Desc"
Source: MSDN
Comments
Post a Comment