In this article we will learn how to select only one row of a GridView using RadioButtons whereas normally a RadioButton does not support selection of only one RadioButton within a row.
Background
In ASP.Net the GridView control does not support selection of a single RadioButton that works as a group across rows. Generally as you know a RadioButton is a control that works in a group for selecting only one option. If we take RadioButtonList control it will work everywhere, which applies to a GridView also but if we use only one RadioButton control for each row in GridView it will not allow us to select only one. Try selecting a RadioButton in every row; it will allow selection of multiple rows in GridView. Here we will see how to restrict the user to select only one RadioButton within a GridView control.
For doing this task I've written some Javascript function. This function actually I got from somewhere while Google search. We will step by step follow.
Step 1
Start new website. Put the GridView control on the Default.aspx page with RadioButton control in TemplateField like bellow.
- <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
- DataKeyNames="AuthId">
- <Columns>
- <asp:TemplateField ShowHeader="false">
- <ItemTemplate>
- <asp:RadioButton ID="rdbauthid" runat="server" onclick="javascript:CheckOtherIsCheckedByGVID(this);" />
- </ItemTemplate>
- </asp:TemplateField>
- <asp:BoundField HeaderText="AUTHOR NAME" DataField="AuthName" />
- <asp:BoundField HeaderText="AUTHOR LOCATION" DataField="AuthLocation" />
- </Columns>
- </asp:GridView>

Arbind KumarPosted Aug 22, 2017, 5:07 AM
How can i get radio button value at server side in c#, Please help in this
Joyal ShahPosted Nov 25, 2014, 12:08 AM
This article is really helpful. Thanks for this :)
Nikhil MittalPosted Nov 23, 2014, 6:45 AM
good article... it works smoothly
Umesh KordePosted Jul 31, 2013, 6:19 AM
good article krushna...
Mohammad Amanul HuquePosted Dec 3, 2012, 12:29 AM
The article is very helpful, Thank you :)
milan patelPosted Nov 24, 2011, 2:07 AM
this article is really helpfull to me Thanks........ http://trickgeek.blogspot.com/
Mayur GujrathiPosted May 13, 2011, 2:06 AM
Dear sir i am calling one another javascript and checked changed event then how can i call this another javascript given by you and this javascript is also use some where else on other events please tell <asp:TemplateField HeaderText="SELECT"> <ItemTemplate> <asp:RadioButton ID="check" runat="server" OnCheckedChanged="check_CheckedChanged" ToolTip ="javascript:ViewSIGN();" AutoPostBack="true" Visible="true"> </asp:RadioButton > </ItemTemplate> </asp:TemplateField>