Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6224031
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T08:35:50+00:00 2026-05-24T08:35:50+00:00

I created two template column in DataGrid.I assigned radio buttons to those columns.I created

  • 0

I created two template column in DataGrid.I assigned radio buttons to those columns.I created single selection by calling a javascript function for the first radio button.
But,I cant’t do single selection by calling a javascript function for the second radio button.Also,I can’t run independently of each other.

      <asp:TemplateColumn HeaderText="">
     <ItemTemplate>
      <input type="radio" runat="server" id="rd1" onclick="SelectOne(this,'DataGrid')" VALUE="rd1"
       NAME="RadioGroup1" />
     </ItemTemplate>
    </asp:TemplateColumn>
    <asp:TemplateColumn HeaderText="">

     <ItemTemplate>
      <input type="radio" runat="server" id="rd2" onclick="test(this,'DataGrid')" VALUE="rd2" 
      NAME="RadioGroup2" />      
     </ItemTemplate>
    </asp:TemplateColumn>

Javascript Code:

  <script  language="javascript">
  function SelectOne(rd1,DataGrid)
  {
  all=document.getElementsByTagName("input");
  for(i=0;i<all.length;i++)
  {
  if(all.type=="radio")
   {
   var count=all.id.indexOf(DataGrid+'__ctl');
  if(count!=-1)
   {
    all.checked=false;
   }
   }
  }
   rd1.checked=true;
  }
  </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T08:35:51+00:00Added an answer on May 24, 2026 at 8:35 am

    Is it necessary to run the radio buttons as server side controls? It may be easier to manage if you remove the runat=server and just emit a unique group name instead for each radio button that is part of the same group since that will prevent asp.net from changing the ID’s. You can then check the selected values using Request[“RadioGroupName”] instead of with the server control value property.

    This will keep the groups working correctly, and it will make your javascript to select the radio buttons simpler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created two simple XAML files which contain a single TextBox. The first template
I created two dropdpwn calendar in my form with these codes: <script type=text/javascript src=http://code.jquery.com/jquery-latest.js></script>
I have problem about django template-db query relationship. For example, I created two tables
I created two simple functions which get template parameters and an empty struct defining
I have two columns, the second column depends on the content on the first
I've created a two-worksheet template in Excel - the first sheet is for pretty
consider the two template functions below: template <typename T, typename A> T* create(A i)
i have two files:(localhost/template/) index.php template.php each time when i create an article(an article
I created two classes in netbeans;One of them is a JPanel form and another
I created two files in the App_GlobalResources folder: SiteResources.en-US.resx SiteResources.sp-SP.resx Both contain a value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.