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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:43:26+00:00 2026-05-27T02:43:26+00:00

I have a class Lot with a function AddPiece(piece). I also have a Page

  • 0

I have a class Lot with a function AddPiece(piece).

I also have a Page with a button btnPanel that on click fires the function

public void btnPanel_OnClick(object sender, EventArgs e){}

I want to call the btnPanel_OnClick from the Addpiece function but when I try to do it it does not show in the intlliSense and I get this compilation error “The name ‘btnPanel_OnClick’ does not exist in the current context”. Both classes are in the same namespace. Is this possible?

Here is what I have:

namespace GraphicW_Array
{
  public partial class Board : System.Web.UI.Page
  {
    public void btnPanel_OnClick(object sender, EventArgs e)
    {
      ...code...
     }
   }
 }

and

namespace GraphicW_Array
{
  public class Lot
  {
    public void addPiece(int piece)
    {
        lotPresent[lotLoad] = piece;
        lotLoad++;
    }
  }
}
  • 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-27T02:43:27+00:00Added an answer on May 27, 2026 at 2:43 am

    I think the answer is yes you can but you probably don’t want to. To call the method you need and instance of your page class so you could do

    namespace GraphicW_Array
    {
      public class Lot
      {
        public void addPiece(int piece)
        {
            lotPresent[lotLoad] = piece;
            lotLoad++;
            var myPage = new Board();
            myPage.btnPanel_OnClick(null,EventArgs.Empty);
        }
      }
    }
    

    But what would that actually do? I have no idea because you haven’t posted the code but i suspect it won’t do anything useful for you.

    What are you actually trying to achieve?

    Maybe this is want you want

    namespace GraphicW_Array
        {
          public class Lot
          {
            public void addPiece(int piece, Board myPAge)
            {
                lotPresent[lotLoad] = piece;
                lotLoad++;
                myPage.btnPanel_OnClick(null,EventArgs.Empty);
            }
          }
        }
    

    Then in your page you can call it like this:

    var myLot = new Lot();
    myLot.addPiece(4,this);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a class library where we keep a lot of the stuff that
I have a class that inherits from a base class (this contains a lot
We currently have a utilities class that handles a lot of string formatting, date
I have class with a member function that takes a default argument. struct Class
I have a function in my class that creates a thread and gives it
Lets say I have a class like this in Java: public class Function {
In my code I have a class that contain a lot of functions and
I have a class like this: class A { public $var = ; function
I have the following class structure: class Parent { public function process($action) { //
I have a lot of comparer classes where the class being compared is simply

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.