55
rated 0 times
[
56]
[
1]
/ answers: 1 / hits: 42530
/ 12 Years ago, wed, september 26, 2012, 12:00:00
I have a radibutton list.
<asp:RadioButtonList ID=RadioButtonList1 runat=server
RepeatDirection=Horizontal RepeatLayout=flow >
<asp:ListItem Selected=True Text =Yes Value=0></asp:ListItem>
<asp:ListItem Text =No Value=1></asp:ListItem>
</asp:RadioButtonList>
And to get the value from radio list I have a function :
function getvalueofradiolist() {
var radiolist = document.getElementById('<%= RadioButtonList1.ClientID %>');
var rblName = radiolist.name;
var radio = document.getElementsByName(rblName);
for (var x = 0; x < radio.length; x++) {
if (radio[x].checked) {
alert(Selected item Value + radio[x].value);
}
}
}
But it returns undefined.
Did I write something wrong?
I am calling this function on button click.
Suggest me If I can do this with the help of code behind in spite of Javascript.
More From » asp.net