nicas
asked on
asp.net radiobuttonlist selectedindex in javascript
Hello
I need to get the selectedindex of a asp.net radiobuttonlist in a javascript, anyone know how to do this?
The radiobuttonlist is declared like this:
-------------------------- ---------- ---------- ---------- ----------
<asp:radiobuttonlist id="rbl_menu_atgard" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rb l_menu_atg ard_OnChan ge">
<asp:ListItem Value="Scenario">Scenario< /asp:ListI tem>
<asp:ListItem Value="Prognos">Prognos</a sp:ListIte m>
<asp:ListItem Value="Regleringar">Rappor tera regleringar</asp:ListItem>
</asp:radiobuttonlist>
The generated html becomes like this:
-------------------------- ---------- ---------- ---------- ---------- -
<table id="rbl_menu_atgard" border="0">
<tr>
<td><input id="rbl_menu_atgard_0" type="radio" name="rbl_menu_atgard" value="Scenario" onclick="__doPostBack('rbl _menu_atga rd_0','')" language="javascript" /><label for="rbl_menu_atgard_0">Sc enario</la bel></td>
</tr>
<tr>
<td><input id="rbl_menu_atgard_1" type="radio" name="rbl_menu_atgard" value="Prognos" onclick="__doPostBack('rbl _menu_atga rd_1','')" language="javascript" /><label for="rbl_menu_atgard_1">Pr ognos</lab el>
</td>
</tr>
<tr>
<td><input id="rbl_menu_atgard_2" type="radio" name="rbl_menu_atgard" value="Regleringar" checked="checked" onclick="__doPostBack('rbl _menu_atga rd_2','')" language="javascript" /><label for="rbl_menu_atgard_2">Ra pportera regleringar</label>
</td>
</tr>
</table>
when i retrieve the radiobuttonlist in a javascript like this:
var menu = document.getElementById('r bl_menu_at gard');
i can't access the selectedindex and options array. I need help on how to solve this.
please
/Nick
I need to get the selectedindex of a asp.net radiobuttonlist in a javascript, anyone know how to do this?
The radiobuttonlist is declared like this:
--------------------------
<asp:radiobuttonlist id="rbl_menu_atgard" runat="server" AutoPostBack="true" OnSelectedIndexChanged="rb
<asp:ListItem Value="Scenario">Scenario<
<asp:ListItem Value="Prognos">Prognos</a
<asp:ListItem Value="Regleringar">Rappor
</asp:radiobuttonlist>
The generated html becomes like this:
--------------------------
<table id="rbl_menu_atgard" border="0">
<tr>
<td><input id="rbl_menu_atgard_0" type="radio" name="rbl_menu_atgard" value="Scenario" onclick="__doPostBack('rbl
</tr>
<tr>
<td><input id="rbl_menu_atgard_1" type="radio" name="rbl_menu_atgard" value="Prognos" onclick="__doPostBack('rbl
</td>
</tr>
<tr>
<td><input id="rbl_menu_atgard_2" type="radio" name="rbl_menu_atgard" value="Regleringar" checked="checked" onclick="__doPostBack('rbl
</td>
</tr>
</table>
when i retrieve the radiobuttonlist in a javascript like this:
var menu = document.getElementById('r
i can't access the selectedindex and options array. I need help on how to solve this.
please
/Nick
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think that what i had answered is relevant to the question and i think that my solution will solve the posted problem.
Thanks,
Nanda