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

The Archive Base Latest Questions

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

The code public partial class Table_Traversing : System.Web.UI.Page { Table table1 = new Table();

  • 0

The code

    public partial class Table_Traversing : System.Web.UI.Page
        {
        Table table1 = new Table();

        Button button1 = new Button();

        protected void Page_Load(object sender, EventArgs e)
        {
            for (int adding_rows = 0; adding_rows < 4; adding_rows++)
               {
               TableRow table_row1 = new TableRow();
               TableCell table_cell1 = new TableCell();
               TableCell table_cell2 = new TableCell();
               Label The_text = new Label();
               CheckBox checkmate = new CheckBox();
               The_text.Text = "This is the text :-)";
               checkmate.ID = "checkmate";
               table_cell2.Controls.Add(checkmate);
               table_cell1.Controls.Add(The_text);
               table_row1.Controls.AddAt(0, table_cell1);
               table_row1.Controls.AddAt(1, table_cell2);
               table1.Rows.Add(table_row1);
               }
            button1.Text = "click me to export the value";
            form1.Controls.AddAt(0, table1);
            form1.Controls.AddAt(1, button1);
            button1.Click += new EventHandler(button1_Click);     
        }

        void button1_Click(object sender, EventArgs e)
        {
        CheckBox check_or_not = new CheckBox();
         for (int i = 0; i < table1.Rows.Count; i++)
            {
             check_or_not = (CheckBox)table1.Rows[i].FindControl("checkmate");
             Response.Write(check_or_not.Checked.ToString());
             }       
         }
      }

The error

Multiple controls with the same ID ‘checkmate’ were found. FindControl requires that controls have unique IDs.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Multiple controls with the same ID ‘checkmate’ were found. FindControl requires that controls have unique IDs.

  • 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-16T17:47:10+00:00Added an answer on May 16, 2026 at 5:47 pm

    You added the checkbox to the cell, not the row:

    table_cell2.Controls.Add(checkmate);
    

    Hence – one row has multiple cells with id “checkmate”:

    E.g

    <tr id="somerow">
       <td><input type="checkbox" id="checkmate"/></td>
       <td><input type="checkbox" id="checkmate"/></td>
    </tr>
    

    So within the row “somerow”, there are multiple checkboxes with id “checkmate”.

    Your code to add the checkboxes seemingly looks like you’re only adding one though – so it must be something you’ve missed.

    Try removing the FindControl code and see what actual HTML get’s rendered.

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

Sidebar

Related Questions

Here is my code: public partial class Image : System.Web.UI.Page { protected void Page_Load(object
In the following master.cs code: public partial class Default : System.Web.UI.MasterPage { protected void
I have the following code: public partial class queryTerm : System.Web.UI.UserControl { private static
The winform: The code: using System; using System.Windows.Forms; namespace DemoApp { public partial class
With this code: public partial class Form1 : Form { private static readonly int
I have following code public partial class MainWindow : Window { public MainWindow() {
I have this code in my class [MetadataType(typeof(HipaaBenefit_Metadata))] public partial class HipaaBenefit { public
If I'm registering events on a UserControl in the code behind. E.g.: public partial
Code: public IEnumerable<CalendarItem> GetCalendarItems(DateTime? startDate = new DateTime?(), DateTime? endDate = new DateTime?()) {
My Code:- public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.webview); // defining the WebView WebView

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.