Friday, May 20, 2011

Hide and Visible using Javascript

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript" type="text/javascript">
    function forRentClicked() {

        if (document.getElementById('<%=CheckBox1.ClientID%>').checked == true) {

            RadioButtonList1.style.display = 'block';

        }
        else {
            RadioButtonList1.style.display = 'none';
        }
    }  
    </script> 
</head>
<body>
    <form id="form1" runat="server">
    <div> 
    <asp:CheckBox ID="CheckBox1" runat="server" Text="Items" onClick="forRentClicked()" /> 
        <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal" style="display:none;">
        <asp:ListItem>One</asp:ListItem>
        <asp:ListItem>Two</asp:ListItem>
        </asp:RadioButtonList>
</div> 

    </form>
</body>
</html>

 

output :

visible

0 comments:

Post a Comment