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 6049329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:33:53+00:00 2026-05-23T07:33:53+00:00

I have some checkboxes dynamically created in C# codebehind. Let’s say two columns. This

  • 0

I have some checkboxes dynamically created in C# codebehind. Let’s say two columns. This works fine.

I want the checkboxes in the left column to enable/disable those in the right upon check. I do this by attaching attributes to the checkboxes in codebehind that run javascript to do the enabling/disabling. This works great.

Here’s the javascript:

function SetPrimaryStatus(target, senders) {
    var dis = "disable";
    var arr = senders.split(",");
    for (var i = 0; i < arr.length; i++) {
        if (document.getElementById(arr[i]).checked == true) {
            dis = "";
            break;
        }
    }
    document.getElementById(target).disabled = dis;
    if (dis == "disable") document.getElementById(target).checked = false;
}

I thought I was home free…I just have to disable the right column checkboxes upon creation in the codebehind (CheckBox.Enabled = false;). Ok.

For whatever reason now, when I check the left checkboxes, the right ones do nothing. I’ve set alerts in the javascript and they always come up…and things appear to be set like they should. When I remove the CheckBox.Enabled = false; in codebehind, it works again.

In fact, I can start some of the left checkboxes with a check and the corresponding right checkbox I leave enabled. When I run the set(s) that starts enabled works perfect but the set(s) that start with the right checkbox disabled do not.

Is there something other than Enabled that I should be setting in codebehind to start the checkboxes in a disabled state that the javascript can then change? Is it a matter of true/false compared to “disable”? I’ve tried both.

  • 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-23T07:33:53+00:00Added an answer on May 23, 2026 at 7:33 am

    I found the answer here: http://forums.asp.net/t/982967.aspx/1.

    I had to add document.getElementById(target).parentElement.disabled = dis; to my javascript function. All works as expected now. Thanks for everyone’s suggestions.

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

Sidebar

Related Questions

Basically I have a set of checkboxes that are dynamically created from view data
I have a form field (a series of checkboxes) that's being created dynamically from
I have an ASP.NET page with JavaScript. I have some checkboxes and I want
I have some WPF ListBox which is dynamically populating with items. Something like this
I have some checkboxes in a button set and I want to use Jquery
I have some classes layed out like this class A { public virtual void
I have some code like this in a winforms app I was writing to
I have some kind of test data and want to create a unit test
I have some checkboxes with class=check. How can I obtain the ID of all
I have some 34 checkboxes on one Activity which i have to mark and

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.