Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Repeater use with Radiobutton


Message #1 by toymaker@u... on Fri, 19 Apr 2002 16:52:07
We're using a repeater to dump out a list of records from a dataset, and 
want to have a radiobutton set up for each record, with them all in the 
same group.  So far what we have looks like this:


<ItemTemplate>
	<tr bgcolor="f1f4f8">
		<td>
			<asp:RadioButton ID="rbPolicy" Runat="server" 
GroupName="Policy"></asp:RadioButton>
		</td>
		<td><%# databinder.eval(Container.dataitem,"PolicyNumber") 
%></td>
		<td><%# databinder.eval(Container.dataitem,"LOB") %></td>
		<td><%# databinder.eval
(Container.dataitem,"EffectiveDate") %></td>
		<td><%# databinder.eval
(Container.dataitem,"ExpirationDate") %></td>
	</tr>
	<TR bgcolor="f1f4f8">
		<td></td>
		<td align="right">Status:&nbsp;&nbsp;</td>
		<td><%# databinder.eval(Container.dataitem,"Status") %
></td>
		<td></td>
		<td></td>
	</TR>
</ItemTemplate>


It gives us the radio button and all the data for each record, but for 
some reason the GroupName vanishes when we run it, so we can select every 
one of the radiobuttons if we like.  How do we fix this?

Also, once we do, I'm not sure how to find out which radiobutton has been 
pressed.  When I run the webform, each radiobutton looks like this:


<input id="rptPolicies__ctl1_rbPolicy" type="radio" 
name="rptPolicies:_ctl1:Policy" value="rbPolicy" />


(then ctl2, ctl3, etc) How would I check to see which button had been 
selected once I get back to the back-end code?  Any advice appreciated.  
Thanks.

  Return to Index