ASP.NET GridView RadioButton

Posted on 2012-08-29
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
    LVL 23

    Accepted Solution


    Check the CodeProject article -

    Hope it helps u...

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now