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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:53:58+00:00 2026-06-01T04:53:58+00:00

hello i m doing a very simple Asp.net application project namespace WebApplication1 { public

  • 0

hello i m doing a very simple Asp.net application project

 namespace WebApplication1
 {
 public partial class WebUserControl1 : System.Web.UI.UserControl
 {
    market m = new market();

    protected void Page_Load(object sender, EventArgs e)
    {


    }
    protected void button_clickSell(object sender, EventArgs e) 
    {


        float price = float.Parse(this.BoxIdPrezzo.Text);

        m.insertProd("xxx", 10, "yyy");
        m.addOfferForProd("ooo", 5, "gggg");
        m.insertProd(this.BoxIdDescrizione.Text,price,this.BoxIdUtente.Text);
        String s;
        m.outMarket(out s);  
        this.Output.Text = s;  //the output here work good
        this.Output.Visible = true;

    }
    protected void button_clickView(object sender, EventArgs e) 
    {
        String s;
        m.outMarket(out s);
        this.Output.Text = s;  // here seem to have lost the reference to product why?
        this.Output.Visible = true;
    }
}
}

the problem is that when i click on button1 which call button_clickSell everything works good but when i click on button2 which call button_clickView products seem to not be anymore in the Market object, but this is pretty strange because in market object i have a list of product and m.outMarket in the first time work propely.

  • 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-01T04:53:59+00:00Added an answer on June 1, 2026 at 4:53 am

    That is because of how pages work. Every time you make a request or a post-back to the page the values will be lost in that variable.

    You will need to hold that in a session or something similar.

    Here is a very basic example of using a session.

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Collection"] == null)
            {
                Session["Collection"] = new List<int>();
            }//if
        }
        protected void button_clickSell(object sender, EventArgs e)
        {
            List<int> collection = (List<int>)Session["Collection"];
            collection.Add(7);
            collection.Add(9);
        }
        protected void button_clickView(object sender, EventArgs e)
        {
            List<int> collection = (List<int>)Session["Collection"];
            collection.Add(10);
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A very simple project. Here's the Activity subclass: public class Home extends Activity {
i'm creating a very simple (hello World quality) web application using spring mvc 3.0.
I'm doing some test on a very, very simple application using Spring . My
Hello I am in the process of doing a school project, where we have
What am I doing wrong here: class Helo { // main: generate some simple
Hello again ladies and gents! OK, following on from my other question on ASP.NET
I'm developing an asp.net webservice application to provide json-formatted data to a widget that
I have an ASP.net project which involves using a custom IHttpModule. This module will
Hello, I have the following problem: public class TestCombo extends JFrame{ public TestCombo() {
Doing some javascript self-learning and the program itself is very simple. It searches through

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.