protected void btnOk_Click(object sender, EventArgs e) { Brand oldBrand = (Brand)Session["OLDBRAND"]; Brand newBrand = new Brand(); newBrand.Name = txtCity.Text; if (Session["EDITMODE"] == null || !(bool)Session["EDITMODE"]) { client.AddBrand(newBrand); } else { client.ModifyBrand(oldBrand, newBrand); Session["EDITMODE"] = false; Session["OLDBRAND"] = null; } txtCity.Text = ""; pnlCity.Visible = false; Response.Redirect(Request.RawUrl); }