Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help w/Repeater control & radio buttons

Status
Not open for further replies.

meckeard

Programmer
Aug 17, 2001
619
US
Hi,

I am using the repeater control to list all the addresses of a customer. I need a radio button to the left of each so the customer can select which one they want to use.

I wanted to use the asp:RadioButton, but I can't assign a value to it. If I try, it won't display on the page. I can't seem to get a regular HTML radio button to work if I try to write code to check to see if atleast one is selected.

Any suggestions? I am open to chaning my code as long as it works.

Thanks,
Mark
 
You could, instead, manipulate a DataGrid or Table dynamically. In the appropriate event, you could incorporate logic to add a new radio buttons to each row using the Controls collection property of cells or something. You can also look into column templates.

Good luck! :)
 
use radiobuttonlist instead and set RepeatDirection to Horizontal;
<asp:radiobuttonlist id=&quot;SomeRadio&quot; runat=&quot;server&quot; RepeatDirection=&quot;Horizontal&quot;>
<asp:ListItem Value=&quot;1&quot;>Yes</asp:ListItem>
<asp:ListItem Value=&quot;0&quot;>No</asp:ListItem>
</asp:radiobuttonlist>

IN the code, you will treat this somewhat like a selectbox

hth
 
jgillin,

But I don't know what values will populate the radiobuttonlist.

The page in question will read addresses from a database for a customer. Each address will have a radio button to the left. One radio button needs to be selected in order to continue.

With that said, I would need a datagrid, repeater, etc in order to list the addresses from a datareader. Or loop thru the datareader and response.write the addresses. In either case, I need the radio button to signify the selected address.

Any ideas?

Thanks,
Mark
 
Actually, jgillian is right. I forgot about the RadioButtonList. You can just bind the list to the DataReader as you would a different control.
 
meck --

Why don't you just display the addresses in a listbox, and set the selection on single and go from there?
 
BoulderBum,

I will look into the RadioButtonList. My 2 books don't go in to much detail, so I didn't think that was possible.

Isadore -- I thought about that, but didn't like it from a visual stand point.

Thanks,
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top