Radio Buttons in Repeater Control

Discussion in 'ASP .Net' started by SouthSpawn, Aug 13, 2005.

  1. SouthSpawn

    SouthSpawn Guest

    I know this is probably pretty trival.
    I am trying to put a radio button inside
    a repeater control. That will allow me to select each row one by one. Then
    once the user clicks on the submit button. It determines which row has been
    selected.

    Can anyone post me a code sample.

    Thanks,
    Mark
     
    SouthSpawn, Aug 13, 2005
    #1
    1. Advertising

  2. SouthSpawn

    Karl Seguin Guest

    you put a radio button in it like you normally would <asp:radiobutton
    id="choice" .. /> in the item template.

    Then in the button's click, you can look through the repeater's Items
    collection and do a findControl.. Here is some quasi pseudo (As it probably
    won't work as-is)

    for each item as RepeaterItem in myRepeater.Items
    dim rad as RadioButton = ctype(item.FindControl("choice"), RadioButton)
    if rad.Selected = true then
    'item is checked, do something, you can use item to figure out which
    row it was..
    end if
    next

    Karl
    --
    MY ASP.Net tutorials
    http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
    http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
    come!)


    "SouthSpawn" <> wrote in message
    news:...
    >I know this is probably pretty trival.
    > I am trying to put a radio button inside
    > a repeater control. That will allow me to select each row one by one. Then
    > once the user clicks on the submit button. It determines which row has
    > been
    > selected.
    >
    > Can anyone post me a code sample.
    >
    > Thanks,
    > Mark
    >
     
    Karl Seguin, Aug 14, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeroen Klooster

    Re: Radio Buttons in a Repeater Control

    Jeroen Klooster, Apr 7, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    2,929
    Jeroen Klooster
    Apr 13, 2004
  2. Replies:
    0
    Views:
    620
  3. Scott D Johnson
    Replies:
    1
    Views:
    1,075
    Scott D Johnson
    Sep 27, 2006
  4. Dr. Leff
    Replies:
    3
    Views:
    299
    David Mark
    Oct 15, 2007
  5. Dr. Leff
    Replies:
    3
    Views:
    230
    David Mark
    Oct 15, 2007
Loading...

Share This Page