Radio Buttons in Repeater Control

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
 
K

Karl Seguin

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top