protected void btnOk_Click(object sender, EventArgs e) { City oldCity = (City)Session["OLDCITY"]; City newCity = new City(); newCity.Name = txtCity.Text; if (Session["EDITMODE"] == null || !(bool)Session["EDITMODE"]) { client.AddCity(newCity); } else { client.ModifyCity(oldCity, newCity); Session["EDITMODE"] = false; Session["OLDCITY"] = null; } txtCity.Text = ""; pnlCity.Visible = false; Response.Redirect(Request.RawUrl); }