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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:04:20+00:00 2026-05-31T05:04:20+00:00

I’m a bit stuck with refactoring my code to make a method available to

  • 0

I’m a bit stuck with refactoring my code to make a method available to another page. I have the following code which is giving me trouble. Maybe there is a better angle to come at this from? Essentially I’m trying to make a function static so I can reuse the code but it’s tripping me up.

public static Table BuildProjectTable(string CRNumber)
{
    LinkButton SelectLink = new LinkButton();
    SelectLink.ID = CRNumber + "," + ShipId + "," + StageId;
    ProgressStatus CurrentStatus = AAGlobal.GetProgressStatus(CRNumber, ShipId, StageId);
    SelectLink.Text = CurrentStatus.CurrentAssignee;
    SelectLink.BackColor = CurrentStatus.CurrentStatus;
    SelectLink.ForeColor = Color.White;
    BodyCells[CellCount].BackColor = CurrentStatus.CurrentStatus;
    BodyCells[CellCount].ForeColor = Color.White;

    // This fails because SelectLink_Click isn't static (I think)
    //
    SelectLink.Click += new EventHandler(SelectLink_Click);

    BodyCells[CellCount].Controls.Add(SelectLink);

    CellCount++;
}


// If I make this static (fixing above error), Session, Response and lstProcess
// all complain an object reference is required

public void SelectLink_Click(object sender, EventArgs e)
{
    LinkButton ClickedLink = (LinkButton)sender;
    string[] ClickRef = ClickedLink.ID.ToString().Split(',');

    Session["CR_NUMBER"] = ClickRef[0];
    Session["SHIP_ID"] = ClickRef[1];
    Session["STAGE_ID"] = ClickRef[2];
    Session["PROCESS_NAME"] = lstProcess.SelectedValue;

    Response.Redirect("~/EditStage.aspx");
}
  • 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-31T05:04:22+00:00Added an answer on May 31, 2026 at 5:04 am

    What is the “lstProcess” ? Is it static ?

    If it’s not, your problem might come from that…

    Also, assuming you are making asp.net, Session, Response, Cookies,.. are not static and depends on a Request. This explains why you don’t have access to them..
    Anyway, making an EventHandler static is not a good idea.

    Maybe you should consider making a new static method that takes a Session and whatever you need in parameters and calling it from the EventHandler.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

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.