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

The Archive Base Latest Questions

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

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

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


 TableRow table_row1 = new TableRow();

 TableCell table_cell1 = new TableCell();

 TableCell table_cell2 = new TableCell();

 Label The_text = new Label();

 CheckBox checkmate = new CheckBox();

 Button button1 = new Button();



 public void Page_Init(object sender, EventArgs e)
 {
     //Table asdasd = new Table();
 }


 protected void Page_Load(object sender, EventArgs e)
 {


    The_text.Text = "This is the text :-)";

    checkmate.Checked = false;

    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(0, button1);


    CheckBox check_or_not = new CheckBox();

    check_or_not = (CheckBox)table1.FindControl("checkmate");

    Response.Write(check_or_not.Checked.ToString());


    button1.Click += new EventHandler(button1_Click);





 }

The error is

Object reference not set to an instance of an object.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

Line 59: check_or_not = (CheckBox) table1.FindControl(“checkmate”);

Line 60:

Line 61: Response.Write(check_or_not.Checked.ToString());

Line 62:

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

    You have to give the control an ID, if you want to use FindControl … so you have to add this before invoking FindControl:

    checkmate.ID = "checkmate";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code public partial class Table_Traversing : System.Web.UI.Page { Table table1 = new Table();
Here is my code: public partial class Image : System.Web.UI.Page { protected void Page_Load(object
I have the following code: public partial class queryTerm : System.Web.UI.UserControl { private static
In the following master.cs code: public partial class Default : System.Web.UI.MasterPage { protected void
Given this class public partial class Default : Page { private IRepository repo; ...
I have a page that is setup like this public partial class _Default :
Consider this source: public partial class FormTest : Form { private Test test {
With this code: public partial class Form1 : Form { private static readonly int
say I have this control: public partial class bloc999 : UserControl { bloc999Data mainBlock
I have a program that looks something like this: public partial class It {

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.