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. General Programming
  3. C#
  4. DataGrid Sorting Problem using a DataSet from ViewState

DataGrid Sorting Problem using a DataSet from ViewState

Scheduled Pinned Locked Moved C#
helpalgorithms
2 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.
  • V Offline
    V Offline
    veroBT
    wrote on last edited by
    #1

    I've got a page with two panels. The first panel contains the search parameters (textboxes and drop downs). The second panel shows the results of the search. On the result page, i allow paging and sorting. Everything works great if i rebuild the dataset each time i change pages or change the sort. But when I cache the dataset in ViewState and try to change pages or the sort, it just takes my back to the parameter page automatically. Nothing else happens. Here's my code for the Sort: ViewState.Add("str_sortOrder", e.SortExpression); DataView dvwResults = new DataView(); dvwResults = dst_searchResults.Tables[0].DefaultView[0].DataView; dvwResults.Sort = ViewState["str_sortOrder"].ToString(); this.dgr_searchResults.DataSource = dvwResults; this.dgr_searchResults.DataKeyField = "aut_companyID"; this.dgr_searchResults.DataBind(); All help is appreciated. Brian

    H 1 Reply Last reply
    0
    • V veroBT

      I've got a page with two panels. The first panel contains the search parameters (textboxes and drop downs). The second panel shows the results of the search. On the result page, i allow paging and sorting. Everything works great if i rebuild the dataset each time i change pages or change the sort. But when I cache the dataset in ViewState and try to change pages or the sort, it just takes my back to the parameter page automatically. Nothing else happens. Here's my code for the Sort: ViewState.Add("str_sortOrder", e.SortExpression); DataView dvwResults = new DataView(); dvwResults = dst_searchResults.Tables[0].DefaultView[0].DataView; dvwResults.Sort = ViewState["str_sortOrder"].ToString(); this.dgr_searchResults.DataSource = dvwResults; this.dgr_searchResults.DataKeyField = "aut_companyID"; this.dgr_searchResults.DataBind(); All help is appreciated. Brian

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      Please redirect your question to the appropriate forum, the ASP.NET[^] forum. This posting is provided "AS IS" with no warranties, and confers no rights. Software Design Engineer Developer Division Sustained Engineering Microsoft [My Articles]

      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