Link to home
Start Free TrialLog in
Avatar of Donnie4572
Donnie4572Flag for United States of America

asked on

Sort Datetime

Hi,
I'm using vb.net web application. I have this code to sort data in a datagrid. The data comes from sql 2000 database.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
       
        If IsPostBack Then
            Ds1 = CType(Session("Ds"), ds)
        Else
            da.Fill(Ds1)
            Session("ds") = Ds1
            dg.DataSource = Ds1.mytable.DefaultView
            dg.DataMember = ""
            dg.DataBind()
        End If
    End Sub

    Private Sub dg_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles dg.SortCommand
        dg.DataSource = Dsschedview1.schedule.DefaultView
        Ds1.schedule.DefaultView.Sort = e.SortExpression
        dg.DataBind()
    End Sub

This Works for all my columns except it will not sort my datetime column.
Any idea why?
Donnie
ASKER CERTIFIED SOLUTION
Avatar of TRUENEUTRAL
TRUENEUTRAL

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Donnie4572

ASKER

Thanks for reply. I have corrected this. The Dataadapter had a sort for my date column.