I looked quite a bit on the net to try to find a solution do do this, and most of what I came across didn’t work for some reason or another. It can get a little tricky to get the SelectedItem from an ASP.Net RadioButtonList in Javascript, but hopefully, this explanation of how it works, along with Javascript code will help you understand it a little more.

I’m including 2 JS variables here – label and radio. The’ label’ tag is what the HTML page uses for the items list of the RadioButton List. However, for the value portion of each item, an ‘input’ tag is used. Here, the example returns the actual text of the selected item which is displayed .


function getRBLVal(rblList) 
            {
                var rbl = document.getElementById(rblList);
                var radio = rbl.getElementsByTagName("input");
                var label = rbl.getElementsByTagName("label");
                for (var i = 0; i < radio.length; i++) 
                {
                    if (radio[i].checked) 
                    {
                        return label[i].innerHTML;
                    }
                }
                    return false;
            }

If you want the value portion, you would use the following statement:

Return radio[i].value

To use the function, you would do something like this:


var rbl = getRBLVal('<%=YourRBLId.ClientID%>');