Sorting of datagrid column

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • alan

    Sorting of datagrid column

    I set the datagrid to be sortable,
    sort expression = "Column1 asc"

    but when i click the column name
    the datagrid doesn't load anything, did i miss sth. on the sorting? thanks a
    lot!!

    in Sort_Command event handler

    Dim SortView As DataView = DataSet11.Produ cts.DefaultView
    SortView.Sort = e.SortExpressio n
    DataGrid1.DataS ource = SortView
    DataGrid1.DataB ind()

  • Sachi

    #2
    RE: Sorting of datagrid column

    I am not sure how your entire code look like.
    I suggest you to take a look at this small example in below article.


    Sachi

    "alan" wrote:
    [color=blue]
    > I set the datagrid to be sortable,
    > sort expression = "Column1 asc"
    >
    > but when i click the column name
    > the datagrid doesn't load anything, did i miss sth. on the sorting? thanks a
    > lot!!
    >
    > in Sort_Command event handler
    >
    > Dim SortView As DataView = DataSet11.Produ cts.DefaultView
    > SortView.Sort = e.SortExpressio n
    > DataGrid1.DataS ource = SortView
    > DataGrid1.DataB ind()
    >[/color]

    Comment

    • alan

      #3
      RE: Sorting of datagrid column

      i am using asp.net (VB), and Access Database
      i make the connection and make a datagrid from the OleDbAdaptor

      I tick "allow sorting" and enter "colName asc" as sort expression the
      property builder of the datagrid

      i want to use the "dataview" approach to sort the columns
      if i add "if not me.ispostback", nothing will be loaded after click the
      column head
      if not add, the column will give no response even i click the column head

      thanks a lot!

      Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
      System.EventArg s) Handles MyBase.Load
      OleDbDataAdapte r1.Fill(DataSet 11)
      datgrid1.DataBi nd()
      End Sub

      in Sort_Command event handler

      Dim SortView As DataView = DataSet11.Produ cts.DefaultView
      SortView.Sort = e.SortExpressio n
      DataGrid1.DataS ource = SortView
      DataGrid1.DataB ind()


      "Sachi" wrote:
      [color=blue]
      > I am not sure how your entire code look like.
      > I suggest you to take a look at this small example in below article.
      > http://www.dotnetjunkies.com/Article...0D57699C3.dcik
      >
      > Sachi
      >
      > "alan" wrote:
      >[color=green]
      > > I set the datagrid to be sortable,
      > > sort expression = "Column1 asc"
      > >
      > > but when i click the column name
      > > the datagrid doesn't load anything, did i miss sth. on the sorting? thanks a
      > > lot!!
      > >
      > > in Sort_Command event handler
      > >
      > > Dim SortView As DataView = DataSet11.Produ cts.DefaultView
      > > SortView.Sort = e.SortExpressio n
      > > DataGrid1.DataS ource = SortView
      > > DataGrid1.DataB ind()
      > >[/color][/color]

      Comment

      Working...