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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:47:03+00:00 2026-05-28T01:47:03+00:00

I am using javascript to make unchecked GridView . But whenever I try, I

  • 0

I am using javascript to make unchecked GridView .
But whenever I try, I cannot make unchecked it.

function UncheckedItemsCheckBox(CheckboxID) {
      var checkbox = document.getElementById(CheckboxID);
      checkbox.checked = false;            
      alert(checkbox.id + " : " + checkbox.name + " : " + checkbox.checked);
}

Here is the output.

---------------------------
Message from webpage
---------------------------
GridView1_ctl02_txtDoseQty : GridView1$ctl02$txtDoseQty : false
---------------------------
OK   
---------------------------

Even though “checkbox.checked” return me “false” as output message shown, but at the gridview checkbox is still checked.

Could anyone please give me suggestion?

  • 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-28T01:47:03+00:00Added an answer on May 28, 2026 at 1:47 am

    What may be happening is that your CheckBoxID is wrong, and therefore returning the wrong element.

    In JavaScript, saying checkbox.checked = false; will, if this object did not previously have a checked property, add one to the object, with the value provided. So, if your CheckBoxID is in fact wrong, it’s no surprise your alert shows false; any non-null element you pull back with getElementById will allow you to add a checked property to it.

    More specifically, in asp.net when you create a checkbox column, like this

    <asp:CheckBoxField Text="Hello" DataField="foo" />
    

    it renders html like this:

    <span class="aspNetDisabled">
        <input id="gv_ctl00_0" type="checkbox" name="gv$ctl02$ctl00" disabled="disabled">
        <label for="gv_ctl00_0">Hello</label>
    </span>
    

    A couple possibilities:

    1. The id you’re getting may be of the span, on which you’re adding a checked property.
    2. You’re setting the checkbox to be checked, but since it’s disabled, it’s not updating its state — ok, it looks like disabled checkboxes can have their checked properties updated. Hopefully #1 is your problem.

    A good place to start debugging would be to change your function to this

    function UncheckedItemsCheckBox(CheckboxID) {
          var checkbox = document.getElementById(CheckboxID);
    
          alert(checkbox.checked);  // <------- should display false, but will 
                                    // display undefined if this element is 
                                    // something other than a checkbox
    
          checkbox.checked = false;            
          alert(checkbox.id + " : " + checkbox.name + " : " + checkbox.checked);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a drop down menu using javascript/jquery but can't get my
I am traversing a HTML document using javascript DOM. I want make a list
I am using simple javascript to make an ajax call , which works well.But
How can I, using Javascript, make a function that will trim string passed as
Without using Javascript, is there a way to make a CSS property toggle on
I am currently using a javascript code to make an entire row in my
How to make multiple forms with shared fields without using javascript? <input type=text name=username
Im using JavaScript, the HTML5 canvas-element and WebGL to make a simple 3D-game in
How can I make a visitor's browser go fullscreen using JavaScript, in a way
How do I make a user's browser blink/flash/highlight in the task bar using JavaScript?

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.