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

  • SEARCH
  • Home
  • 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 6327231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:14:25+00:00 2026-05-24T17:14:25+00:00

Hi friends i have a button control which has to be enabled based on

  • 0

Hi friends i have a button control which has to be enabled based on my asp.net checkbox check,but when run the code i am facing the problem my button is still disabled even after i perform a checkbox check .is their any property i have set in code behind to acccess the check event.

I am using the following code in my application
This is my javascript file

<script type="text/javascript">
                    function theChecker() {
                        var checkboxId = '<%=  SpEligible.ClientID %>';
                        alert(checkboxId);
                        if (checkboxId.checked == true)
                             {
                            document.getElementById("SplistButton").disabled = false;
                             }
                             else
                              {
                            document.getElementById("SplistButton").disabled = true;
                              }
                            }
</script>

This is my code for the checkbox and button is

<asp:CheckBox ID="SpEligible" runat="server" Text="SpEligible" class="cBox"   />
   <asp:Button ID="SplistButton" runat="server" OnClientClick=" return ShowInsertForm()"    Enabled="false"/>

This is my aspx.cs file where i am calling the javascript

SpEligible.Attributes.Add("onclick", "theChecker()");
  • 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-24T17:14:25+00:00Added an answer on May 24, 2026 at 5:14 pm

    I can see two major errors in your code :

    1- In your <script> tag, you did realize that your Checkbox wouldn’t have the same ID once in the page, but you didn’t made that check. Also, as Ken Pespisa mentioned, the ID you took is only a string, therefore, it doesn’t know any checked property. Here is the code I would write :

    <script type="text/javascript">
        function theChecker() {
            var checkboxId = '<%=  SpEligible.ClientID %>';
            alert(checkboxId);
            if (document.getElementById(checkboxId).checked == true)
            {
                document.getElementById("<%=  SplistButton.ClientID %>").disabled = false;
            }
            else
            {
                document.getElementById("<%=  SplistButton.ClientID %>").disabled = true;
            }
        }
    </script>
    

    2- In your .cs page, you don’t seem to use any namespace. You may have hide some code, so I’ll just say be sure to have namspaces and be sure to use this line inside a function, maybe the page load event function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

friends, i have a EditText on simple activity with a button. when every i
friends, i have created custom title bar using following titlebar.xml file with code <?xml
Greetings friends, In my MySQL database, I have 'MAB' table which contains information about
friends, i have a page on which i am displaying image from gallery then
Friends, My apex page has several different radio groups, each one can have the
Friends, I have an application, ten pages, but full of buttons(with background images), big
I have the following problem in ASP.NET: there is a form that contains a
Possible Duplicate: Create a usercontrol instance programmatically in ASP.NET Dear Friend i have the
i have a list in android. and it has 30 records currently. but on
hello friends i have created a UDP chatting program through which the clients can

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.