Radio Buttons in Repeater Control

  • Thread starter Thread starter SouthSpawn
  • Start date Start date
S

SouthSpawn

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
 
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
 
Back
Top