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

  • Home
  • SEARCH
  • 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 8759211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:44:40+00:00 2026-06-13T14:44:40+00:00

I am trying to add Checkboxes dynamically to webpage string[] words = masg.Split(‘~’); int

  • 0

I am trying to add Checkboxes dynamically to webpage

            string[] words = masg.Split('~');
            int size = words.Length;
            CheckBox[] cbl = new CheckBox[size];
            for (int i = 0; i < words.Length; i++)
            {
                cbl[i] = new CheckBox();
                cbl[i].Text = words[i].ToString();
                this.Controls.Add(cbl[i]);  
               // Response.Write("\n" + words[i]);
            }

I am getting error

Control ‘ctl01’ of type ‘CheckBox’ must be placed inside a form tag with runat=server.

How should I proceed ? What changes to make on aspx page ? Please 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-06-13T14:44:41+00:00Added an answer on June 13, 2026 at 2:44 pm

    You should change it to add in form, because this is referencing your Page. and any server control which you are creating programmatic or by adding on page with runat="server" should place inside a form tag.

    like

    this.Form.Controls.Add(cbl[i]);
    

    or place a placeholder or panel on the form. and than you can add in it

    like

    placeholder1.Controls.Add(cbl[i]); 
    

    If your .aspx does not contain a form tag, then you should place a form tag there

    like

    <form runat="server" id="form1">
    
     //Other mark up or server controls.
    
    </form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to add checkboxes dynamically with the help of javascript. However my
I am trying to dynamically add some content to a list of checkboxes in
I am trying to add a custom data-required attribute to an asp Checkbox control,
I am trying add picture boxes dynamically. My code is as PictureBox picture =
So, I'm trying to dynamically add a button to a site to give the
I am in the process of trying to add dynamic checkbox to my activity.
I am trying to add a class to a label of a checkbox on
I'm trying to use checkboxes to add users to a specific group but I'm
I'm trying to add and remove divs using checkboxes. Some help for this script
I am trying to add 2 variables which both happen to be checkboxes to

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.