ASP.NET GridView RadioButton

Posted on 2012-08-29
Medium Priority
Last Modified: 2012-08-29
I want to add a RadioButton in my Gridview.   The functionality should work that when I click on the RadioButton only one button is selected (not like a checkbox where you can have multiple selects).  Here is what I have but I am able to select more than one.  Any ideas how to fix?

<asp:GridView ID="grdCoList" AllowSorting="True" 
  OnSorting ="grdCoList_Sorting" width="100%"
  runat="server" CellPadding="4" ForeColor="#333333" GridLines="None"   
  AutoGenerateColumns="False" HeaderStyle-VerticalAlign="Bottom" >
  <PagerStyle BackColor="#919191" Font-Bold="True" ForeColor="White" 
     HorizontalAlign="Center" />
  <HeaderStyle BackColor="#919191" Font-Bold="True" ForeColor="White" />  
  <RowStyle BackColor="#EAEAEA" />
  <AlternatingRowStyle BackColor="White" />
               <asp:RadioButton ID="rbSelected" runat="server" GroupName="CoGroup" />
       <asp:BoundField DataField="CoID" HeaderText="Co ID" SortExpression="CoID" 
            HeaderStyle-VerticalAlign="Bottom" ItemStyle-Wrap="false" 
            HeaderStyle-Wrap="false" />
       <asp:BoundField DataField="CoName" HeaderText="Co Name" 
            SortExpression="CoName" HeaderStyle-VerticalAlign="Bottom" 
            ItemStyle-Wrap="false" HeaderStyle-Wrap="false" />

Open in new window

Question by:CipherIS
LVL 18

Assisted Solution

by:Rajar Ahmed
Rajar Ahmed earned 1000 total points
ID: 38346879
LVL 23

Accepted Solution

Roopesh Reddy earned 1000 total points
ID: 38346880

Check the CodeProject article - http://www.codeproject.com/Articles/7960/How-to-group-RadioButtons

Hope it helps u...

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question