こんにちは、非常に単純な Asp.net アプリケーション プロジェクトを行っています。
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;
}
}
}
問題は、button_clickSell を呼び出す button1 をクリックするとすべて正常に動作しますが、button_clickView 製品を呼び出す button2 をクリックすると、Market オブジェクトにはもうないように見えますが、Market オブジェクトには製品のリストがあるため、これはかなり奇妙です。と m.outMarket は初めて適切に機能します。