• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 299
  • Last Modified:

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
0
Donnie4572
Asked:
Donnie4572
1 Solution
 
TRUENEUTRALCommented:
what does the e equal when you are sorting by datetime?
0
 
Donnie4572Author Commented:
Thanks for reply. I have corrected this. The Dataadapter had a sort for my date column.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now