Archive for July, 2014

Hide and Show Table based on selection of any one CheckBox

July 17, 2014 Leave a comment

Hi all,

try this example to Hide and show table based on selection of any one checkbox using Javascript

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<link href=""
rel="stylesheet" type="text/css" />
<script src=""></script>
<script src=""></script>
<script type="text/javascript">
$(document).ready(function () {
//Attach event handlers for all checkboxes
$('#<%=check1.ClientID%>,#<%=check2.ClientID%>,#<%=check3.ClientID%>').on("click", function () {
//Check atlest one checkbox is checked
if ($("input[type=checkbox]:checked").length > 0) {
//Show the table
$('#<%=tblone.ClientID %>').show();
else {
//hide the table
$('#<%=tblone.ClientID %>').hide();
<form id="form1" runat="server">
<asp:CheckBox ID="check1" runat="server" Text="Check 1" />
<asp:CheckBox ID="check2" runat="server" Text="Check 2" />
<asp:CheckBox ID="check3" runat="server" Text="Check 3" />
<table id="tblone" runat="server" style="display: none">

Hope this helps

Good Luck.

Categories: ASP.Net, Javascript