datagrid won't sort

Discussion in 'ASP .Net Datagrid Control' started by DC Gringo, Feb 29, 2004.

  1. DC Gringo

    DC Gringo Guest

    I have a datagrid that won't sort. The event handler is firing and return
    label text, just not the sort.

    Here's my Sub Page_Load and Sub DataGrid1_SortCommand:

    --------------------

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here
    SqlDataAdapter1.Fill(DsAdvanced1)

    If Not IsPostBack Then
    DataGrid1.DataBind()
    Provinces.DataBind()
    Districts.DataBind()
    SubDistricts.DataBind()
    Communities.DataBind()
    End If

    End Sub

    --------------------


    Public Sub DataGrid1_SortCommand(ByVal source As Object, ByVal e As
    System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles
    DataGrid1.SortCommand

    lblWhatClicked.Text = "You clicked: " & e.SortExpression

    Dim dv As New DataView(DsAdvanced1.Tables(0))
    dv.Sort = e.SortExpression
    DataGrid1.DataSource = dv
    DataGrid1.DataBind()

    End Sub

    --
    _____
    DC G
     
    DC Gringo, Feb 29, 2004
    #1
    1. Advertising

  2. Your post went unanswered. Have you resolved this issue?

    --
    Regards,
    Alvin Bruney [ASP.NET MVP]
    Got tidbits? Get it here...
    http://tinyurl.com/3he3b
    "DC Gringo" <> wrote in message
    news:OaAMDdu$...
    > I have a datagrid that won't sort. The event handler is firing and return
    > label text, just not the sort.
    >
    > Here's my Sub Page_Load and Sub DataGrid1_SortCommand:
    >
    > --------------------
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    > 'Put user code to initialize the page here
    > SqlDataAdapter1.Fill(DsAdvanced1)
    >
    > If Not IsPostBack Then
    > DataGrid1.DataBind()
    > Provinces.DataBind()
    > Districts.DataBind()
    > SubDistricts.DataBind()
    > Communities.DataBind()
    > End If
    >
    > End Sub
    >
    > --------------------
    >
    >
    > Public Sub DataGrid1_SortCommand(ByVal source As Object, ByVal e As
    > System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles
    > DataGrid1.SortCommand
    >
    > lblWhatClicked.Text = "You clicked: " & e.SortExpression
    >
    > Dim dv As New DataView(DsAdvanced1.Tables(0))
    > dv.Sort = e.SortExpression
    > DataGrid1.DataSource = dv
    > DataGrid1.DataBind()
    >
    > End Sub
    >
    > --
    > _____
    > DC G
    >
    >
     
    Alvin Bruney [MVP], Mar 2, 2004
    #2
    1. Advertising

  3. DC Gringo

    DC Gringo Guest

    Sort of...thankfully I'm only in beta and I got it to work without using
    code-behind...I must have issues relating to the sharing of variables
    between the separate pages...



    -____-
    DG


    "Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
    news:...
    > Your post went unanswered. Have you resolved this issue?
    >
    > --
    > Regards,
    > Alvin Bruney [ASP.NET MVP]
    > Got tidbits? Get it here...
    > http://tinyurl.com/3he3b
    > "DC Gringo" <> wrote in message
    > news:OaAMDdu$...
    > > I have a datagrid that won't sort. The event handler is firing and

    return
    > > label text, just not the sort.
    > >
    > > Here's my Sub Page_Load and Sub DataGrid1_SortCommand:
    > >
    > > --------------------
    > >
    > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > System.EventArgs) Handles MyBase.Load
    > > 'Put user code to initialize the page here
    > > SqlDataAdapter1.Fill(DsAdvanced1)
    > >
    > > If Not IsPostBack Then
    > > DataGrid1.DataBind()
    > > Provinces.DataBind()
    > > Districts.DataBind()
    > > SubDistricts.DataBind()
    > > Communities.DataBind()
    > > End If
    > >
    > > End Sub
    > >
    > > --------------------
    > >
    > >
    > > Public Sub DataGrid1_SortCommand(ByVal source As Object, ByVal e As
    > > System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles
    > > DataGrid1.SortCommand
    > >
    > > lblWhatClicked.Text = "You clicked: " & e.SortExpression
    > >
    > > Dim dv As New DataView(DsAdvanced1.Tables(0))
    > > dv.Sort = e.SortExpression
    > > DataGrid1.DataSource = dv
    > > DataGrid1.DataBind()
    > >
    > > End Sub
    > >
    > > --
    > > _____
    > > DC G
    > >
    > >

    >
    >
     
    DC Gringo, Mar 2, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DC Gringo

    Datagrid won't sort

    DC Gringo, Feb 29, 2004, in forum: ASP .Net
    Replies:
    7
    Views:
    1,204
    DC Gringo
    Mar 1, 2004
  2. Chad
    Replies:
    4
    Views:
    8,352
  3. Replies:
    1
    Views:
    4,766
    Patrick.O.Ige
    Nov 5, 2005
  4. PatLaf

    AspNet DataGrid won't fire sort routine

    PatLaf, Oct 29, 2003, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    190
    Alvin Bruney
    Oct 30, 2003
  5. Navin
    Replies:
    1
    Views:
    710
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page