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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:38:29+00:00 2026-05-22T16:38:29+00:00

I have dynamically created an array of checkboxes in a button1 click event. Now

  • 0

I have dynamically created an array of checkboxes in a button1 click event. Now I want to check its checked property in another button2 click event. Since the check box controls are dynamically created at runtime, I am not able to access it in button2 click event. Please anybody help me with a solution for this.

public void Display(ref string[] strDmn, ref string[][] strAvblty)
{
    ch = new CheckBox[cntExt / 2];
    strDomInfo = new string[cntExt / 2];
    Table t = new Table();
    t.Caption = "Domain Availablity";
    t.BorderWidth = 1;
    TableRow tr;
    TableCell tc;
    System.Drawing.ColorConverter colConvert = new ColorConverter();

    for (int i = 0; i < (strDmn.Length); i++)
    {
        for (int l = 0; l < ((strAvblty[i].Length) / 2); l++)
        {
            tr = new TableRow();
            tr.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("#F0E8FF");
            for (int j = 0; j < 4; j++)
            {
                //string k = strAvblty[i][(i * 2 + 1)];
                tc = new TableCell();
                tc.Width = 300;
                switch (j)
                {
                    case 0:
                        ch[k - 1] = new CheckBox();
                        strDomInfo[k - 1] = strDmn[i] + "." + strAvblty[i][(l * 2)];
                        if (strAvblty[i][(l * 2) + 1] == "available")
                        { }
                        else { ch[k - 1].Enabled = false; }
                        tc.Controls.Add(ch[k - 1]);
                        break;
                    case 1: tc.Text = strDmn[i];
                        break;
                    case 2: tc.Text = strAvblty[i][(l * 2)];
                        break;
                    case 3: tc.Text = strAvblty[i][(l * 2) + 1];
                        break;
                }
                tr.Cells.Add(tc);
            }
            t.Rows.Add(tr);
        }
    }
    // desiredPanel is your panel
    Panel1.Controls.Add(t);
}

protected void btnAdd2Cart_Click(object sender, EventArgs e)
{
    //******I have get the boolen check property here ******
}
  • 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-22T16:38:30+00:00Added an answer on May 22, 2026 at 4:38 pm

    You have to create these checkboxes in the Page_Init and they should be recreated on postback. Then you will be able to get the values in the Button2's click handler

    protected void Page_Init(object sender, EventArgs e)
    {
     // Create here
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dynamically created array of integers. Now I have to remove all
I have some dynamically created inputs which are not server-side controls. I want to
I have problem with dynamically created image (JavaScript). I want to change the innerHTML
I want to fill in a dynamically created array once only at the top
I have the need to store a list/collection/array of dynamically created objects of a
I have a form that has an array of dynamically created labels of varying
I'm trying to create an array of checkboxes dynamically and also want to put
i have a list of dynamically created check boxes. when the state of the
I have dynamically created an array of labels. however, when i tried to set
I have a dynamically created image that I am saving to a stream so

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.