Hi JagadishMohan...,
Refer the below example how to sort more than one column of DataTable. Also try to implement code as per logic in your project.
C#
DataTable dtProjectDetails = new DataTable();
dtProjectDetails.Columns.AddRange(new DataColumn[3] { new DataColumn("AutoId",typeof(int))
, new DataColumn("ProjectId",typeof(string))
, new DataColumn("INVOICENO",typeof(string))});
dtProjectDetails.Rows.Add(1, "ST-2014", "-");
dtProjectDetails.Rows.Add(2, "ST-2013", "-");
dtProjectDetails.Rows.Add(3, "ST-2013", "1");
dtProjectDetails.Rows.Add(4, "ST-2014", "-");
dtProjectDetails.Rows.Add(5, "ST-2014", "3");
dtProjectDetails.Rows.Add(6, "ST-2013", "-");
dtProjectDetails.Rows.Add(7, "ST-2014", "2");
dtProjectDetails.Rows.Add(8, "ST-2013", "-");
dtProjectDetails.Rows.Add(9, "ST-2014", "-");
dtProjectDetails.Rows.Add(40, "ST-2013", "-");
dtProjectDetails.Rows.Add(31, "ST-2014", "5");
dtProjectDetails.Rows.Add(22, "ST-2014", "-");
dtProjectDetails.Rows.Add(13, "ST-2013", "-");
dtProjectDetails.Rows.Add(14, "ST-2014", "6");
dtProjectDetails.Rows.Add(15, "ST-2013", "-");
dtProjectDetails.Rows.Add(16, "ST-2013", "-");
dtProjectDetails.Rows.Add(17, "ST-2013", "-");
dtProjectDetails.Rows.Add(18, "ST-2014", "7");
dtProjectDetails.Rows.Add(19, "ST-2014", "-");
dtProjectDetails.Rows.Add(20, "ST-2013", "8");
var ordered = dtProjectDetails.AsEnumerable()
.OrderBy(en => en.Field<string>("ProjectId"))
.ThenBy(en => en.Field<int>("AutoId")).CopyToDataTable();
VB.Net
Dim dtProjectDetails As New DataTable()
dtProjectDetails.Columns.AddRange(New DataColumn(2) {New DataColumn("AutoId", GetType(Integer)), New DataColumn("ProjectId", GetType(String)), New DataColumn("INVOICENO", GetType(String))})
dtProjectDetails.Rows.Add(1, "ST-2014", "-")
dtProjectDetails.Rows.Add(2, "ST-2013", "-")
dtProjectDetails.Rows.Add(3, "ST-2013", "1")
dtProjectDetails.Rows.Add(4, "ST-2014", "-")
dtProjectDetails.Rows.Add(5, "ST-2014", "3")
dtProjectDetails.Rows.Add(6, "ST-2013", "-")
dtProjectDetails.Rows.Add(7, "ST-2014", "2")
dtProjectDetails.Rows.Add(8, "ST-2013", "-")
dtProjectDetails.Rows.Add(9, "ST-2014", "-")
dtProjectDetails.Rows.Add(40, "ST-2013", "-")
dtProjectDetails.Rows.Add(31, "ST-2014", "5")
dtProjectDetails.Rows.Add(22, "ST-2014", "-")
dtProjectDetails.Rows.Add(13, "ST-2013", "-")
dtProjectDetails.Rows.Add(14, "ST-2014", "6")
dtProjectDetails.Rows.Add(15, "ST-2013", "-")
dtProjectDetails.Rows.Add(16, "ST-2013", "-")
dtProjectDetails.Rows.Add(17, "ST-2013", "-")
dtProjectDetails.Rows.Add(18, "ST-2014", "7")
dtProjectDetails.Rows.Add(19, "ST-2014", "-")
dtProjectDetails.Rows.Add(20, "ST-2013", "8")
Dim ordered = dtProjectDetails.AsEnumerable().OrderBy(Function(en) en.Field(Of String)("ProjectId")).ThenBy(Function(en) en.Field(Of Integer)("AutoId")).CopyToDataTable()
ScreenShot