Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6948079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:46:32+00:00 2026-05-27T13:46:32+00:00

this is my .aspx page where i am using JQuery Based on the check

  • 0

this is my .aspx page where i am using JQuery
Based on the check box checked and uncheck i should make an div display and hide
i here when i am displaying the div tag i am even reseting the dropdown values

but when ever i check/uncheck the checkbox nothing seems happening

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>
    <%-- <script type="text/javascript">
    <script type="text/javascript" src="JScript.js"></script>--%>

    <script src="jquery-1.6.2.min.js" type="text/javascript"></script>

    <script type="text/javascript">
    $(document).ready(function() 
    {
    if ($("#CheckBox1").is(':checked')) 
    { 
     $('#divControlGroup').css("display", "block"); 
     $("#ddlcounty option:first").attr("selected", true);

    } 
    else 
    { 
    $('#divControlGroup').css("display", "none"); 

     } 
    })
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <table>
        <tr>
            <td>
                <asp:CheckBox ID="CheckBox1" runat="server" Checked="false" />
            </td>
            <td>
                <div id="divControlGroup" runat="server">
                    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                    <asp:DropDownList ID="ddlcounty" runat="server">
                        <asp:ListItem Value="0">Select</asp:ListItem>
                        <asp:ListItem Value="1">India</asp:ListItem>
                        <asp:ListItem Value="2">US</asp:ListItem>
                        <asp:ListItem Value="3">UK</asp:ListItem>
                    </asp:DropDownList>
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>

pls let me know where i amgoing where, any help would be great

Thanks

finally anser for the problem

<script type="text/javascript">
    $(document).ready(function() 
    {
     $('#<%= CheckBox1.ClientID %>').change(function() 
    {    
     if($(this).is(':checked')) 
     {       
      $("#divControlGroup").css("display", "block");   
      $("#ddlcounty option:first").attr("selected", true); 
      } 
     else 
        { 
    $("#divControlGroup").css("display", "none"); 
     } 
        })
        });
    </script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T13:46:33+00:00Added an answer on May 27, 2026 at 1:46 pm

    Your current code only executes once when the page is loaded. It looks like you’ll want to bind to the checkbox’s change event:

    $('#CheckBox1').change(function() {
    
       if($(this).is(':checked')) {
    
          ...
    
       }
    
    });
    

    Update

    I just noticed you’re using .NET controls. If the above code does not solve your problem, the issue is probably that the rendered IDs are not the same as the IDs you give your control. In your browser, select View Source, to see what the ID really is.

    If you’re using .NET 4, you can set ClientIDMode="Static" on your checkbox, to make sure that the ID of the rendered control will really be CheckBox1.

    See ClientIDMode.

    If you’re using a .NET version lower than 4, you would have to pass CheckBox1.ClientID to your JavaScript.

    Something like:

    $('#<%= CheckBox1.ClientID %>').change(function() {
    
       if($(this).is(':checked')) {
    
          ...
    
       }
    
    });
    

    Another option, which will work regardless of .NET version, would be to assign an ID to a wrapper:

    <td id="my-checkbox">
        <asp:CheckBox ID="CheckBox1" runat="server" Checked="false" />
    </td>
    
    $('#my-checkbox :checkbox').change(function() { ... });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am loading an aspx page into a div using jquery.load(). The aspx page
I know we've done this before in another .aspx page that's using this master
I'm using jQuery Thickbox to display an iframe (upload.aspx) that allows a user to
I am using jquery ajax method on my aspx page,which will invoke the webmethod
I have no issues when doing using JQuery in a aspx page without a
I have an aspx page that makes an Ajax request (using jquery) to a
I am using Jquery dialog box(jquery-ui-1.8.11.custom.min.js). The source for this dialog box is an
HI. I am using JQuery tabs in my aspx page, but update panel is
I have this in my ASPX page: <input id=MY_LAST_FOCUS name=MY_LAST_FOCUS type=text runat=server /> In
in the aspx page i am getting this error while binding dropdown list Unable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.