Click here to Skip to main content
15,890,336 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the below code to display information into gridview and enable user to select choice, but I want user to select only one choice not multiple choices.

ASP.NET
<asp:GridView ID="grid" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" DataKeyNames="ID">
<Columns>
   <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
   <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
   <asp:TemplateField HeaderText="Select">
       <ItemTemplate>
           <asp:RadioButton ID="CheckBox1" runat="server" GroupName="select"/>
       </ItemTemplate>
   </asp:TemplateField>
</Columns>


So how can I allow user to check only one RadioButton?
Posted

1 solution

I would suggest using a RadioButtonList control instead of a GridView, http://asp-net-example.blogspot.com/2008/10/radiobuttonlist-example-how-to-use.html[^]

There are lots of samples online but the above link is a good one.
 
Share this answer
 
Comments
[no name] 15-May-14 16:24pm    
+5

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