ハローイムを失ったC#のasp.netのオブジェクト参照は、非常に単純な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のすべてが良い働きを呼び出すボタン1をクリックしたとき、私はボタン2をクリックしたときにcall button_clickView製品はMarketオブジェクトにはもう見えないようですが、これは市場オブジェクトには初めての製品とm.outMarketのリストがあるため、かなり奇妙です。
okあなたは例を挙げることができますか?どのようにセッションにそれらを保存するのですか?私にリンクを教えてください? –
セッションの基本的な例を追加しました。もしあなたがそれらを見たことがないなら、もう少し詳しくお読みください。 – Brian
私はそれがこのようにすべきだと思う.. http://stackoverflow.com/questions/6380842/asp-net-do-changes-to-session-objects-persist –