protected void btnOk_Click(object sender, EventArgs e) { AreaCode oldAreaCode = (AreaCode)Session["OLDAREACODE"]; AreaCode newAreaCode = new AreaCode(); newAreaCode.Name = txtCity.Text; if (Session["EDITMODE"] == null || !(bool)Session["EDITMODE"]) { client.AddAreaCode(newAreaCode); } else { client.ModifyAreaCode(oldAreaCode, newAreaCode); Session["EDITMODE"] = false; Session["OLDAREACODE"] = null; } txtCity.Text = ""; pnlCity.Visible = false; Response.Redirect(Request.RawUrl); }