How to SORT DataTable for particular field by using LINQ

lakhansin-22735
Posted by lakhansin-22735 under C# category on | Points: 40 | Views : 1827
We can use below code to SORT a DataTable
DataTable  DtEnvelope = (DataTable) Session["DtEvelopeFromSession"];
DtEnvelope = DtEnvelope.AsEnumerable().OrderBy(row => row.Field<Int32>("Sequence")).CopyToDataTable();

Using LINQ 'OderBy' method very easily we can SORT a DataTable.

Comments or Responses

Login to post response