Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
Default select first radio button
 <div id="ManageAddressPage" runat="server">
        <asp:Repeater ID="Repeater1" runat="server">
     
    <ItemTemplate>
         <div id="EditAddressPage" style="border: solid 1px LightGray;background-color:#f5faff">
        <div style="padding:15px">
                <asp:Label ID="lblAddressID" runat="server" Text='<%# Eval("AddressID") %>' Visible = "false" />
             <asp:RadioButton ID="RadioButton" runat="server"  Onclick="javascript:singleselection(this.id)" ></asp:RadioButton>
            <asp:Label ID="lblContactName" style="margin-right:15px" runat="server" Text='<%# Eval("Name") %>' />
                <asp:Label ID="lblCountry" runat="server" Text='<%# Eval("PhoneNumber") %>' />
            
             </div>

             <div style="margin-left:10px;width:90%;margin-bottom:20px;">
            
                 <asp:Label ID="lbladdress" runat="server" Text='<%# Eval("Address") %>' />
                
             
              
        </div>
             </div>
    </ItemTemplate>
    
       
        
</asp:Repeater>
              
               
               </div>

 <script type="text/javascript" >

        function singleselection(rbid) {
            var rbutton = document.getElementById(rbid);
            var rbuttonlist = document.getElementsByTagName("input")
            for (i = 0; i < rbuttonlist.length; i++) {
                if (rbuttonlist[i].type == "radio" && rbuttonlist[i].id !== rbutton.id) {
                    rbuttonlist[i].checked = false;
                }
                
            }
        }

    </script>

If the above code runs none of the radio button selected , if user clicks then its selecting , but i want by default select 1st option and then if user select any option then select only that option, this page is like selecting the address. Please someone help on this.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

That is because you are not triggering the click on your page load. Try this :-

document.getElementById("RadioButton").click();
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!