Click here to Skip to main content
15,920,602 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the requirement of using the radio buttons inside the data list control.
but it is not working as there are multiple selections.
how to use it so that there is only single selection?
Posted
Comments
[no name] 9-Apr-12 14:03pm    
How are you using it? Show a little of the code/markup
Chandan Aryan 9-Apr-12 14:08pm    
<asp:DataList ID="dlShift" runat="server" RepeatColumns="3">
<itemtemplate>
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:RadioButton ID="rbShift" runat="server" GroupName="Shift" />
</td>
<td style="width: 100px;">
<asp:Label ID="lblShiftName" runat="server" Text='<%#Eval("ShiftName")%>'>
</td>
<td>
<asp:Label ID="lblPrefix" runat="server" Text="Rs.">
</td>
<td style="width: 150px;">
<asp:TextBox ID="txtCharges" runat="server" Width="100px" Text='<%#Eval("Charges") %>'>
</td>
</tr>
</table>


XML
<asp:DataList ID="DataList1" runat="server" DataKeyField="NationalityID"
            DataSourceID="SqlDataSource1" onitemdatabound="DataList1_ItemDataBound">
            <ItemTemplate>
                Nationality:
                <asp:Label ID="NationalityLabel" runat="server"
                    Text='<%# Eval("Nationality") %>' />
                <br />
                <br />
                <asp:RadioButton ID="RadioButton1" runat="server"/>
            </ItemTemplate>
        </asp:DataList>


Check this link :

http://forums.asp.net/t/1648577.aspx
 
Share this answer
 
Comments
Chandan Aryan 10-Apr-12 4:50am    
Thanx for the solution!! its working fine nw.
Angel1320 10-Apr-12 8:17am    
You Most WelCome
check this


http://www.codeproject.com/Articles/7960/How-to-group-RadioButtons
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900