HI ,
i have one datatable dt in that i have added few Column
after adding Column in dt. i have given these dt as datasource to gridview
once data get loaded in what ever Column i have is not sorting (only date column)
Name Columns is sorting properly plz help me
Dim da As New SqlDataAdapter(Filter, cnn)
dt = New DataTable
da.Fill(dt)
dt.Columns.Add("Col1") dt.Columns.Add("Col2")
For Each R As DataRow In dt.Rows
ArList = GetLatestLevel(R("ClientID"))
If ArList.Count > 0 Then
R("Col1") = ArList(0).ToString()
R("Col2") = ArList(1).ToString()
End If
Next
dgCall.DataSource = dt

ali tuncerRank #1,499 · 1.1K reputationPosted Apr 14, 2016, 5:45 PM EDT
When you create a date column in DataTable, define it as datetime...I think in your case it orders Date column as string...for example 1/2/2016 will be on top of 1/11/2016..
dt.Columns.Add("DateColumn", typeof(DateTime));
RohitRank #9,376 · 207 reputationPosted Apr 13, 2016, 11:20 PM EDT
Amit KumarRank #459 · 5.4K reputationPosted Apr 14, 2016, 9:17 PM EDT
RohitRank #9,376 · 207 reputationPosted Apr 15, 2016, 12:08 AM EDT
RohitRank #9,376 · 207 reputationPosted Apr 15, 2016, 12:09 AM EDT