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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:47:29+00:00 2026-05-24T17:47:29+00:00

i have a page where i create 2 checkboxes dynamically. TableRow tr = new

  • 0

i have a page where i create 2 checkboxes dynamically.

 TableRow tr = new TableRow();
                    for (int i = 0; i < 2; i++)
                    {
                        TableCell Tc = new TableCell();


                            Tc.Attributes["style"] = "line-height: 30px; text-align: left";
                            Tc.Attributes["width"] = "50%";
                            Tc.Style.Add("padding-left", "5px");
                            //Checkboxes on left along with labels
                            CheckBox checkBoxCtrl = new CheckBox();
                            checkBoxCtrl.ID = "checkBoxCtrl" + i;
                            Tc.Controls.Add(checkBoxCtrl); 
                            tr.Cells.Add(Tc);                           
                    }

once they are created in the page load event i have a Ok_button click event which requires to check if the checkbox is checked or not.

 protected void Update2_Click(object sender, EventArgs e)
        {


         if(checkBoxCtrl.checked)
          //here i wont be able to get the value 
          // i get the error the name checkBoxCtrl does not exist..
          {
             response.write("true");
           }

        }

but how do i do the check in this case.

thanks

Answer:

this is what needs to be done to get the checkbox values

 protected void Update1_Click(object sender, EventArgs e)
    {
        for(int i = 0; i < ControlPropList.Count; i++)
        {              
            CheckBox chkTest = (CheckBox)xxx.FindControl("checkBoxCtrl" + i);
            {
                if (chkTest.Checked)
                {
                    Global.logger.Info("Checkbox True = " + chkTest.ID);
                }
                else
                {
                    Global.logger.Info("Checkbox False = " + chkTest.ID);
                }
            }
        }
    }
  • 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-24T17:47:30+00:00Added an answer on May 24, 2026 at 5:47 pm

    This should work fine as long as you add the checkboxes to your page in the Page_PreInit method. If you add them after that (Page_Load for example), their values will not be maintained.

    Read about the asp.net page lifecycle here:

    http://msdn.microsoft.com/en-us/library/ms178472.aspx

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

Sidebar

Related Questions

i have to create an asp.net page dynamically on runtime. It should work like
I have a jsp page with dynamically created checkboxes. When we check boxes, a
I have my views render to route requests like /controller/action (for instance, /Page/Create), so
I have a page which basically allows an admin user to create manager user
I have set permission to allow anonymous user to create page. but when the
I have few question in this regard When you create an internet page, does
I have a multiview control on my page and a menu to create a
I have looked on FaceBook Developer page and found that it's possible to create
I'm trying to create a simple portfolio page. I have a list of thumbs
I'm creating a login page. I want to create ASP.NET TextBox controls that have

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.