protected void btnOk_Click(object sender, EventArgs e) { Size oldSize = (Size)Session["OLDSIZE"]; Size newSize = new Size(); newSize.Name = txtCity.Text; if (Session["EDITMODE"] == null || !(bool)Session["EDITMODE"]) { client.AddSize(newSize); } else { client.ModifySize(oldSize, newSize); Session["EDITMODE"] = false; Session["OLDSIZE"] = null; } txtCity.Text = ""; pnlCity.Visible = false; Response.Redirect(Request.RawUrl); }