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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Getting the selected items from a radioButton group

Getting the selected items from a radioButton group

Scheduled Pinned Locked Moved C#
databasesql-serversysadminregexhelp
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.
  • T Offline
    T Offline
    Twyce
    wrote on last edited by
    #1

    I am trying to get the seleted radioButton from a group of radio buttons. The program is supposed to check on the database for controls that match the selected radiobuttons. The radiobuttons are named High,Medium,Low. For example If a person selects High, the program must go through the database and choose all the controls that are rated High and then must load them into a listBox. My problem is that the code i am using does not see the selected items and does not load the listBox. I am usig SQL server database and stored procedures to do this. Any suggestions on how i can go about doing this will be appreciated.

    M 1 Reply Last reply
    0
    • T Twyce

      I am trying to get the seleted radioButton from a group of radio buttons. The program is supposed to check on the database for controls that match the selected radiobuttons. The radiobuttons are named High,Medium,Low. For example If a person selects High, the program must go through the database and choose all the controls that are rated High and then must load them into a listBox. My problem is that the code i am using does not see the selected items and does not load the listBox. I am usig SQL server database and stored procedures to do this. Any suggestions on how i can go about doing this will be appreciated.

      M Offline
      M Offline
      Michael Eber
      wrote on last edited by
      #2

      Not sure if you are doing this in a web page or in a rich client. In a rich client application it is very easy:

      Create your group and put all radio buttons in there.
      Bind all buttons to a single event handler.
      In the event handler write something like this:
      foreach ( RadioButton item in myGroup.Controls)
      {
      if ( item.Checked )
      {
      // TODO: Insert your code here
      }
      else
      continue;
      }

      Now for the not-so-rich-and-pissy web interface you should confirm that all of your radio buttons have AutoPostBack=true and see if that helps your situation.

      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