protected void btnOk_Click(object sender, EventArgs e) { Role oldRole = (Role)Session["OLDROLE"]; Role newRole = new Role(); newRole.Name = txtCity.Text; if (Session["EDITMODE"] == null || !(bool)Session["EDITMODE"]) { client.AddRole(newRole); } else { client.ModifyRole(oldRole, newRole); Session["EDITMODE"] = false; Session["OLDROLE"] = null; } txtCity.Text = ""; pnlCity.Visible = false; Response.Redirect(Request.RawUrl); }