protected void btnCancel_Click(object sender, System.EventArgs e) { _wizard.CancelAction(); if ((int)ViewState["step"] == (int)ViewState["steps"] + 1) { Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), _wizard.GenerateFinalStepScript(), true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "window.close();", true); } }