Get error when accessing RadioButtonList from javascript that exist in a page that have master page

Posted by Space Cracker on Stack Overflow See other posts from Stack Overflow or by Space Cracker
Published on 2010-03-13T09:17:34Z Indexed on 2010/03/13 9:25 UTC
Read the original article Hit count: 575

Filed under:
|

i have a asp.net page that have its master page and it contain RadioButtonList1 and i try to do thefollwing

<script type="text/javascript">


            var radioButtonList = document.getElementById('<%=RadioButtonList1.ClientID%>');
            if(radioButtonList[0].checked)
                document.getElementById("_secondTR").style.display = "block";
            else if (radioButtonList[1].checked )
                document.getElementById("_secondTR").style.display = "none";
        }  
</script>

<table style="width: 100%">
    <tr id="Tr1">
        <td>
            <asp:RadioButtonList ID="RadioButtonList1" runat="server"  BackColor="#FFCC99"
                RepeatDirection="Horizontal" Width="117px" onclick="ShowHide()">
                <asp:ListItem Value="1">Yes</asp:ListItem>
                <asp:ListItem Value="0">No</asp:ListItem>
            </asp:RadioButtonList>
        </td>
    </tr>
    <tr id="_secondTR" runat="server" style="display: none">
        <td>
            <asp:RadioButton ID="Five" runat="server" GroupName="1" BackColor="#669999" />
            <asp:RadioButton ID="Four" runat="server" GroupName="1" CausesValidation="True" BackColor="#669999" />
        </td>
    </tr>
</table>

i can't get RadioButtonList1 from java script ... could any help me to get that ?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about JavaScript