Hey,

I would like to use the same Object in two functions. But somehow this object is null in the second function.

You first have to click on btnOrder and than you can see the btnConfirm. Because this btnConfirm is on a other panel, which is invisible at start.


Here's my code


private OrderBO order;
protected void btnOrder_Click(object sender, EventArgs e)
{
order= new OrderBO();
order.Adress = txtAdress.Text;
order.BookID = bookID;
order.City = txtWoonplaats.Text;
order.Count = Int32.Parse(txtCount.Text);
order.Date = DateTime.Now;
order.Email = txtEmail.Text;
order.Name = txtNaam.Text;
order.Pc = Int32.Parse(TxtPostcode.Text);

panelOrder.Visible = false;
panelConfirm.Visible = true;
}

protected void btnConfirm_Click(object sender, EventArgs e)
{
lblErrorInsert.Text = OrdersDAL.InsertOrder(order).ToString(); //Here is order null, why?
lblErrorInsert.Visible = true;
}


In the function btnBevestig_Click is the Object order null, I don't see why?