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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:52:38+00:00 2026-06-11T05:52:38+00:00

I have a problem with checkbox. For example, I have this aspx’s code <asp:Content

  • 0

I have a problem with checkbox. For example, I have this aspx’s code

<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" runat="server">
     <asp:CheckBox ID="chkActive" AutoPostBack="True" OnCheckedChanged="Active_OnCheckedChanged" runat="server"></asp:CheckBox>
     <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
</asp:Content>

At server side, when chkActive is checked, I have two rendered controls:

  • ctl00$MainContent$chkActive
  • ctl00$MainContent$txtName

when chkActive is unchecked, I have only one rendered control:

  • ctl00$MainContent$txtName

So I cannot write the status of that checkbox to database. For the record, I use a SaveData function with dynamic object, and chkActive disappeared when unchecked, so this function couldn’t find it. Any idea to make checkbox appeared even when it’s unchecked? Thanks.

P.S: “disappeared” means it’s not in Request.Form anymore when unchecked.

Edited:

My SaveData function:

public void SaveDate<T>(T entity, NameValueCollection attributes)
    {
        PropertyInfo[] properties = typeof(T).GetProperties();
        foreach (PropertyInfo property in properties)
        {
            if (attributes.AllKeys.Any(key => key.Contains("$" + property.Name)))
            {
                //
            }
        }            
    }

The para attributes is from Request.Form, since checkbox is not in Request.Form anymore, so I don’t know how to handle it. This function works well in case checkbox is checked

  • 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-06-11T05:52:40+00:00Added an answer on June 11, 2026 at 5:52 am

    As others have mentioned, the value of the checkbox (unchecked) is not sent back to the server, so it will not appear in the Request.Form collection.

    But… in your function, use can use the server-side objects because the value IS posted back in ViewState (provided you have it on).

    this.chkActive.Checked should be false on postback when unchecked on the client and submitted.

    If you still want to use Request.Form, you can always check to see if the entry exists in the collection. If it is not there, the checkbox was false, or unchecked.

    if(Request.Form["chkActive"] == null)
      // checkbox is unchecked
    else
      // checkbox is checked
    

    EDIT

    To make the checkbox appear in the Request.Form collection, simply add a hidden input to your form and give it the same name as the checkbox.

    <input type="hidden" value="false" name="chkActive" />
    

    Add a client-side event handler to the OnClick event of the checkbox. When checked, set the hidden input’s disabled property to true. When unchecked, set the disabled property to false. Disabled controls are not sent back to the server just like unchecked checkboxes, so if the checkbox is checked, the input should be disabled, and visa-versa.

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

Sidebar

Related Questions

I have a statement that looks like this: <asp:CheckBox ID=CheckBoxProcess Checked='<%#Eval(processedField) %>' OnCheckedChanged=CheckBoxProcess_CheckedChanged runat=server
This is perhaps a rather silly problem. I have a CheckBox on my page
i have one problem controlling checkbox, i'm reading, and searching about the topic but
I have problem with my query on C, I’m using the oci8 driver. This
I have problem developing with live555. I already build the lib-files and example projects
Actually I have solved the problem of having checkbox in the header of a
To dumb it down, I have the following code highlighting my exact problem: <!DOCTYPE
I've been having a lot of trouble with this problem. I have a listview
I have a very big problem solving this issue I have 2 tables first
I'm facing a little problem with my jQuery / Javascript code. I have several

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.