Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


radio input "name" property when runat server

Posted on 2011-02-15
Medium Priority
Last Modified: 2012-06-27

i have the following html

<label id="labelForYes" for="radioYes">Yes</label>
            <input id="radioYes" type="radio" name="radioGroup"
                runat="server" value="1" />
            <label id="labelforNo" for="radioNo"> No</label>
            <input id="radioNo" type="radio" name="radioGroup"
                runat="server" value="0" />


then i want to capture the click event when any radios in that group are clicked.
then get the value of the one radio that was selected...
so i thought i would use this code

  $(document).ready(function() {
        $("#radioGroup input").click(function(){            
               //get the value of the radio that has been selected..

however, this doesnt work as "radioGroup" is getting renamed by
because i need it to be runat server.

can anyone tell me how to access the "real/client" value of name


Question by:MrKevorkian
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 13

Expert Comment

ID: 34897456
Change the code to:

<label id="labelForYes" for="radioYes">Yes</label>
            <input id="radioYes" type="radio" name="radioGroup" onclick="processRadio(1);"
                runat="server" value="1" />
            <label id="labelforNo" for="radioNo"> No</label>
            <input id="radioNo" type="radio" name="radioGroup" onclick="processRadio(0);"
                runat="server" value="0" />
LVL 13

Assisted Solution

devlab2012 earned 600 total points
ID: 34897492
Please refer to my prev comment. Now you can create a function processRadio as:

function processRadio(radioValue)
    if (radioValue == 1)
            //code for YES
             //code for NO

Accepted Solution

MrKevorkian earned 0 total points
ID: 34897804
thanks, that would be a good solution.

i discovered i can do this if i turn my inputs into an asp:radiobuttonlist.

        $('#<%= radioButtonList.ClientID %>').click(function() {

Author Closing Comment

ID: 34936408
i found the answer to this myself, although i was given another good option

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

704 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