public void bntCreate_Click(Object sender, EventArgs e) { var id = Page.Request.Params["id"]; var mail = new EmailNotifications { Title = tbTitle.Text, Body = tbBody.Text }; if (id != null) { mail.ID = Convert.ToInt32(id); mail.Update(); } Page.Response.Redirect("~/ManagerUI/Menu/Content/EmailNotificationsView.aspx"); }