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. GridView with Rows Sorted in Priority Order (Ranked)

GridView with Rows Sorted in Priority Order (Ranked)

Scheduled Pinned Locked Moved ASP.NET
databasequestion
2 Posts 1 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.
  • M Offline
    M Offline
    Muc_
    wrote on last edited by
    #1

    Hi what im askin myself is how i can sort my gridview depending on the rank column in the database? Its Loos like this http://img2.immage.de/09028ecclientpic.jpg I want to move rows up and down in a GridView

    modified on Tuesday, February 9, 2010 9:40 AM

    M 1 Reply Last reply
    0
    • M Muc_

      Hi what im askin myself is how i can sort my gridview depending on the rank column in the database? Its Loos like this http://img2.immage.de/09028ecclientpic.jpg I want to move rows up and down in a GridView

      modified on Tuesday, February 9, 2010 9:40 AM

      M Offline
      M Offline
      Muc_
      wrote on last edited by
      #2

      I solved it(;-

      protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
      {
      if (e.CommandName == "Up")
      {
      int i = int.Parse((string)e.CommandArgument);
      GroupAdapter.Update(Convert.ToInt32(GridView1.DataKeys[i - 1].Values[0].ToString()), i + 1);
      GroupAdapter.Update(Convert.ToInt32(GridView1.DataKeys[i].Values[0].ToString()), i);
      BindData();
      }
      else if (e.CommandName == "Down")
      {
      int i = int.Parse((string)e.CommandArgument);
      GroupAdapter.Update(Convert.ToInt32(GridView1.DataKeys[i + 1].Values[0].ToString()), i);
      GroupAdapter.Update(Convert.ToInt32(GridView1.DataKeys[i].Values[0].ToString()), i + 1);
      BindData();
      }
      }

      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