Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Problem in sorting datagrid in ASP.NET 1.1

Problem in sorting datagrid in ASP.NET 1.1

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netalgorithmshelpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    NetBot
    wrote on last edited by
    #1

    hi all, I have a datagrid with all bound columns and autogenerate columns =false. The problem is the datagrid headers have not become clickable even afer i have made allow sorting=true.They become clickable only if i make autogenerate columns=true. What can be the problem???? Thanks in adv!!!

    V 1 Reply Last reply
    0
    • N NetBot

      hi all, I have a datagrid with all bound columns and autogenerate columns =false. The problem is the datagrid headers have not become clickable even afer i have made allow sorting=true.They become clickable only if i make autogenerate columns=true. What can be the problem???? Thanks in adv!!!

      V Offline
      V Offline
      Venkatesh Mookkan
      wrote on last edited by
      #2

      Check whether you have assigned value in the SortExpression of each BoundColumns. SortExpression might be the column name which is use to sort the GridView.

      [Venkatesh Mookkan] My: Website | Yahoo Group | Blog Spot

      N 1 Reply Last reply
      0
      • V Venkatesh Mookkan

        Check whether you have assigned value in the SortExpression of each BoundColumns. SortExpression might be the column name which is use to sort the GridView.

        [Venkatesh Mookkan] My: Website | Yahoo Group | Blog Spot

        N Offline
        N Offline
        NetBot
        wrote on last edited by
        #3

        Venkatesh Mookkan wrote:

        Check whether you have assigned value in the SortExpression of each BoundColumns. SortExpression might be the column name which is use to sort the GridView.

        I haven`t explicitly specified the sortexpression in the .aspx page. for your reference i m giving you the code Sub FillGrid() cmd = New SqlCommand cmd.Connection = con cmd.CommandText = "List_Party_Info" cmd.CommandType = CommandType.StoredProcedure sda = New SqlDataAdapter sda.SelectCommand = cmd ds = New DataSet sda.Fill(ds) CustGrid.DataSource = ds CustGrid.DataBind() Session("Data") = ds ValidateGrid() End Sub above code is used for binding the grid and the following is the sort command Private Sub CustGrid_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles CustGrid.SortCommand Dim ds1 As DataSet = CType(Session("Data"), DataSet) Dim dv As DataView = ds1.Tables(0).DefaultView dv.Sort = e.SortExpression FillGrid() End Sub Html Code but this event doesn`t fire..Whate can be the problem???

        V 1 Reply Last reply
        0
        • N NetBot

          Venkatesh Mookkan wrote:

          Check whether you have assigned value in the SortExpression of each BoundColumns. SortExpression might be the column name which is use to sort the GridView.

          I haven`t explicitly specified the sortexpression in the .aspx page. for your reference i m giving you the code Sub FillGrid() cmd = New SqlCommand cmd.Connection = con cmd.CommandText = "List_Party_Info" cmd.CommandType = CommandType.StoredProcedure sda = New SqlDataAdapter sda.SelectCommand = cmd ds = New DataSet sda.Fill(ds) CustGrid.DataSource = ds CustGrid.DataBind() Session("Data") = ds ValidateGrid() End Sub above code is used for binding the grid and the following is the sort command Private Sub CustGrid_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles CustGrid.SortCommand Dim ds1 As DataSet = CType(Session("Data"), DataSet) Dim dv As DataView = ds1.Tables(0).DefaultView dv.Sort = e.SortExpression FillGrid() End Sub Html Code but this event doesn`t fire..Whate can be the problem???

          V Offline
          V Offline
          Venkatesh Mookkan
          wrote on last edited by
          #4

          As I already told you, SortExpression is the problem. Please define SortExpression for the BoundColumns to which you want Sort option.

          [Venkatesh Mookkan] My: Website | Yahoo Group | Blog Spot

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups