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. EditIndex after Sorting a gridview

EditIndex after Sorting a gridview

Scheduled Pinned Locked Moved ASP.NET
databasealgorithmshelp
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.
  • J Offline
    J Offline
    johland
    wrote on last edited by
    #1

    hi i have a manually binded GridView with sorting and editing enabled. my problem is with editing columns after sorting them, as the newEditIndex property in the GridView RowEditing event is a reflection of the data from the db and not the dataview that have been set on the gridview Sorting event, the outcome is that when pressing the edit button on a row after sorting, a different row in getting in to edit mode. if any one know the solution please in light me...:} tnx j

    K 1 Reply Last reply
    0
    • J johland

      hi i have a manually binded GridView with sorting and editing enabled. my problem is with editing columns after sorting them, as the newEditIndex property in the GridView RowEditing event is a reflection of the data from the db and not the dataview that have been set on the gridview Sorting event, the outcome is that when pressing the edit button on a row after sorting, a different row in getting in to edit mode. if any one know the solution please in light me...:} tnx j

      K Offline
      K Offline
      kenexcelon
      wrote on last edited by
      #2

      In the sorting event you could set the editindex = -1 and then let the edit button do it's thing. Use the OnRowEditing even and some similar code in that function possibly? GridView grdView = sender as GridView; grdView.EditIndex = e.NewEditIndex; //Rebind grid here...

      Revolutionary: Disk drives go round and round.

      J 1 Reply Last reply
      0
      • K kenexcelon

        In the sorting event you could set the editindex = -1 and then let the edit button do it's thing. Use the OnRowEditing even and some similar code in that function possibly? GridView grdView = sender as GridView; grdView.EditIndex = e.NewEditIndex; //Rebind grid here...

        Revolutionary: Disk drives go round and round.

        J Offline
        J Offline
        johland
        wrote on last edited by
        #3

        i think that as long you are not in edit mode the editIndex will always will be -1? I've solved it by saving the sorting definitions (the expression and direction) in a Session object and retrieved the data with an "ORDER BY" clause giving it these parameters... thanks j

        K 1 Reply Last reply
        0
        • J johland

          i think that as long you are not in edit mode the editIndex will always will be -1? I've solved it by saving the sorting definitions (the expression and direction) in a Session object and retrieved the data with an "ORDER BY" clause giving it these parameters... thanks j

          K Offline
          K Offline
          kenexcelon
          wrote on last edited by
          #4

          Yes, sorry. I misread the question. Glad you got it worked out!

          Revolutionary: Disk drives go round and round.

          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