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. Save sorted ListBox Items??

Save sorted ListBox Items??

Scheduled Pinned Locked Moved C#
databasequestionhelp
4 Posts 3 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.
  • I Offline
    I Offline
    Imran Adam
    wrote on last edited by
    #1

    Hi I have a query with the ListBox control. I have two pages on my web app, a main page and a sort page. The main page contains a table populated with names from a SQL database. The sort page contains a ListBox with all the names from the main page and 2 buttons, Up and Down. The user can move the names Up and Down by clicking the name and pressing Up or Down. Now i would like to know, How can i save the 'sorted' listBox and display that order on the Main Page?? I would greatly appreciate some help. Many Thanks PS this is what i have for moving the items UP/Down protected void Button1_Click(object sender, EventArgs e) { int i = lstBox1.SelectedIndex; string str = lstBox1.SelectedItem.ToString(); if (i > 0) { lstBox1.Items.RemoveAt(i); lstBox1.Items.Insert(i - 1, str); lstBox1.SelectedIndex = i - 1; } } ------------------- Redcastle CRM

    I L 2 Replies Last reply
    0
    • I Imran Adam

      Hi I have a query with the ListBox control. I have two pages on my web app, a main page and a sort page. The main page contains a table populated with names from a SQL database. The sort page contains a ListBox with all the names from the main page and 2 buttons, Up and Down. The user can move the names Up and Down by clicking the name and pressing Up or Down. Now i would like to know, How can i save the 'sorted' listBox and display that order on the Main Page?? I would greatly appreciate some help. Many Thanks PS this is what i have for moving the items UP/Down protected void Button1_Click(object sender, EventArgs e) { int i = lstBox1.SelectedIndex; string str = lstBox1.SelectedItem.ToString(); if (i > 0) { lstBox1.Items.RemoveAt(i); lstBox1.Items.Insert(i - 1, str); lstBox1.SelectedIndex = i - 1; } } ------------------- Redcastle CRM

      I Offline
      I Offline
      Imran Adam
      wrote on last edited by
      #2

      Sorry forgot to mention, I need to have these 2 pages. Everything one 1 page is not suitable in my case. Many Thanks

      ------------------- Redcastle CRM

      M 1 Reply Last reply
      0
      • I Imran Adam

        Sorry forgot to mention, I need to have these 2 pages. Everything one 1 page is not suitable in my case. Many Thanks

        ------------------- Redcastle CRM

        M Offline
        M Offline
        Manas Bhardwaj
        wrote on last edited by
        #3

        What you need to do is save this information(of ordering done at Sort Page) in your database.

        Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        1 Reply Last reply
        0
        • I Imran Adam

          Hi I have a query with the ListBox control. I have two pages on my web app, a main page and a sort page. The main page contains a table populated with names from a SQL database. The sort page contains a ListBox with all the names from the main page and 2 buttons, Up and Down. The user can move the names Up and Down by clicking the name and pressing Up or Down. Now i would like to know, How can i save the 'sorted' listBox and display that order on the Main Page?? I would greatly appreciate some help. Many Thanks PS this is what i have for moving the items UP/Down protected void Button1_Click(object sender, EventArgs e) { int i = lstBox1.SelectedIndex; string str = lstBox1.SelectedItem.ToString(); if (i > 0) { lstBox1.Items.RemoveAt(i); lstBox1.Items.Insert(i - 1, str); lstBox1.SelectedIndex = i - 1; } } ------------------- Redcastle CRM

          L Offline
          L Offline
          leckey 0
          wrote on last edited by
          #4

          FYI...

          Blog link to be reinstated at a later date.

          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