How select one radio button from multiple radio button in gridview

If you want to placed a radio button in gridview as selecting one out of more then one radio button, so use my resources. In this resources user can select single radio button option out of multiple radio button from gridview control using by javascript. No need for define group name in radio button.

Create a test.aspx page.

On test.aspx page

Paste below javascript on .aspx page.

function CheckOnOff(rdoId,grid)
var rdo = document.getElementById(rdoId);
var all = document.getElementsByTagName("input");
for(i=0;i {
if(all[i].type=="radio" && all[i].id !=
var count=all[i].id.indexOf(grid);
rdo.checked=true;/* Finally making the clicked radio button CHECKED */

Now set a gridview on body section of aspx page and placed a radio button control in TemplateField.
set the following properties of a radio button in a Gridview, to allow this script run properly. as following:

<asp:GridView ID="myGrid" runat="server" AutoGenerateColumns="false" >
<asp:TemplateField HeaderText="Select">
<asp:RadioButton id="rdobutton" runat="server" OnClick="javascript:CheckOnOff(,'grid_FreeGifts');"></asp:RadioButton>

Now User can select only one radio button option from multiple option.

Thanks and Regards
Varun Bansal


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: