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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:34:37+00:00 2026-05-13T23:34:37+00:00

Then: protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CheckBoxList1.Items.Add(new ListItem(item1)); CheckBoxList1.Items.Add(new

  • 0

Then:

protected void Page_Load(object sender, EventArgs e)
{
 if (!Page.IsPostBack)
 {
  CheckBoxList1.Items.Add(new ListItem("item1"));
  CheckBoxList1.Items.Add(new ListItem("item2"));
 }
 else
  CheckState();
}

Problem is everytime I debug in CheckState(), CheckBoxList1.Item[0].Selected and CheckBoxList1.Item[1].Selected is always false, even if the checkbox is actually checked!

help?

  • 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-13T23:34:37+00:00Added an answer on May 13, 2026 at 11:34 pm

    You need to add the items to your checkbox list in your page initialization code rather than Page_Load.

    ASP.NET takes the values users post and maps them to your controls during PreLoad (between Init and Load). If you haven’t added the items to your CheckBoxList yet, they don’t exist yet, so ASP.NET can’t select them.

    protected void Page_Init(object sender, EventArgs e) {
        CheckBoxList1.Items.Add(new ListItem("item1"));
        CheckBoxList1.Items.Add(new ListItem("item2"));
    }
    
    protected void Page_Load(object sender, EventArgs e) {
        if (!Page.IsPostBack) {
            CheckState();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my SiteMaster.cs file I have the following snippet: protected void Page_Load(object sender, EventArgs
My code: protected void Page_Load(object sender, EventArgs e) { String userHost = Request.UserHostName }
I am trying to fetch the IP address using this:- protected void Page_Load(object sender,
Is it recommended to check the Page.IsPostBack in a user control Page_Load Event like
Assuming server control of type A has a protected member M , then we
I subclassed UIScrollView Then created an object of it in the main class. Added
If I bind GridView to SqlDataSource, then the first time page will be created,
The following code creates 100 cookies and then enumerates through them via postbacks. protected
Every now and then I get an error when I set up states in
Every now and then, I bump into syntax that I've seen before, but never

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.