This button saves the SharePoint item, sends an alert, then closes the window after the alert is acknowledged.
Here is a simple Cancel button which does not redirect, but will close the window instead.
Enclosed this on the page that is opened in a new window/tab:
HtmlGenericControl btnClose = new HtmlGenericControl("input"); btnClose.Attributes["type"] = "button"; btnClose.Attributes["style"] = "text-align:center; font-size:13px; font-color:#000; font-weight:bold"; btnClose.Attributes["onclick"] = "window.open('', '_self', ''); window.close();"; btnClose.Attributes["value"] = "Click here to close this window or tab."; this.Controls.Add(btnClose);
The window.open that is used is a workaround to ensure most browsers will accept.