---
title: "check box not working properly at page load in asp.net"  
description: "check box not working properly at page load in asp.net"  
author: "E E Cummings"  
published: 2013-07-15  
updated: 2013-07-15  
canonical: https://www.mindstick.com/forum/1292/check-box-not-working-properly-at-page-load-in-asp-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 3 minutes  

---

# check box not working properly at page load in asp.net

Hi [Developers](https://www.mindstick.com/articles/12875/blunders-you-must-avoid-while-hiring-java-developers-to-get-the-best-fulfilling-your-needs)!\

I have got [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) with check-box to enable corresponding [control](https://www.mindstick.com/blog/197/asp-dot-net-repeater-control) next to it. My [Requirement](https://yourviews.mindstick.com/view/85169/becoming-an-influencer-requirement-of-skills-and-knowledge) is at the [page load](https://www.mindstick.com/articles/12909/how-to-open-first-time-popup-on-page-load-in-website) we want to [disable](https://www.mindstick.com/forum/12901/how-to-disable-enable-input-box-in-aspx-with-value-from-sql) the all textboxes and dropdownlists by using [checkbox](https://www.mindstick.com/articles/291/how-should-use-checkbox-control-in-vb-dot-net) if the check-box is checked the control next to that check-box will be enabled for that i have done like this....

at page load

i have written like this

```
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ChckOrdType.Checked = false;
            ChkPlntPric.Checked = false;
            ChkExcluBro.Checked = false;
            ......
            .....
        }
```

and then in checkbox check changed [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) i have written like this

```
   protected void ChckOrdType_CheckChanged(object sender, EventArgs e)
    {
        if (ChckOrdType.Checked)
            ddlOrdType.Enabled = true;
        else
            ddlOrdType.Enabled = false;
    }

    protected void chkPlntPric_CheckChanged(object sender, EventArgs e)
    {
        if (ChkPlntPric.Checked)
            ddlPlntPric.Enabled = true;
        else
            ddlPlntPric.Enabled = false;
    }

    protected void chkExcluBro_CheckChanged(object sender, EventArgs e)
    {
        if (ChkExcluBro.Checked)
            ddlExcluBroker.Enabled = true;
        else
            ddlExcluBroker.Enabled = false;
    }
```

but [results](https://yourviews.mindstick.com/story/4497/usage-of-baking-soda-magical-results) is like this ... I [am getting](https://www.mindstick.com/forum/34179/i-am-getting-error-while-assigning-the-data-to-the-array-list) checkbox not checked and control next to it is enabled...But this not what i want

My results is if the check-box is not checked the control next to it is disabled would any one pls help on this...

Thanks In advance......

## Replies

### Reply by shreesh chandra shukla

Hello E E Cumming!

This is because you have just wrote ONLY to uncheck the checkboxes in the pageload and not to disable the controls behind the checkbox; If thats needed, then your snippet in the pageload should be:

```
if (!Page.IsPostBack){  ChckOrdType.Checked = false;  ChkPlntPric.Checked = false;  ChkExcluBro.Checked = false;  ......  .....  ddlOrdType.Enabled = false;   ddlPlntPric.Enabled = false;  ddlExcluBroker.Enabled = false;    .........}
```

or

```
if (!Page.IsPostBack){  ChckOrdType.Checked = false;  ChkPlntPric.Checked = false;  ChkExcluBro.Checked = false;  ......  .....   ChckOrdType_CheckChanged(sender,e);  chkPlntPric_CheckChanged(sender,e);  chkExcluBro_CheckChanged(sender,e);  ...}
```

i hope this code is helpful for you

\


---

Original Source: https://www.mindstick.com/forum/1292/check-box-not-working-properly-at-page-load-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
