private void SetupForm() { DataAccess oDataAccess = new DataAccess(); FQDNN_Form oForm = oDataAccess.GetFullForm(FormID); FQDNN_FormPage oCurrentPage = null; TotalPages = oForm.FQDNN_FormPage.Count; //find current page foreach (FQDNN_FormPage oFormPage in oForm.FQDNN_FormPage) { this.FindControl(oFormPage.GetControlID()).Visible = false; if (oFormPage.PageNumber == PageNumber) { oCurrentPage = oFormPage; } } if (oCurrentPage != null) { SetupPage(oForm, oCurrentPage); } //display or hide the submit button this.FindControl(oForm.GetSubmitButtonControlID()).Visible = false; if (PageNumber == TotalPages) { FormSettings oFormSettings = new FormSettings(); if (oFormSettings.GetRedirectAction(oForm.FQDNN_FormSetting.ToList()) != FormSettings.FormRedirectActions.LastPageIsFinal) { this.FindControl(oForm.GetSubmitButtonControlID()).Visible = true; ((Button)this.FindControl(oForm.GetSubmitButtonControlID())).Click += SubmitForm; } } //display final generic message if there is not redirect or last page System.Web.UI.Control GenericMessageControl = this.FindControl(oForm.GetGenericMessageControlID()); if (GenericMessageControl != null) { GenericMessageControl.Visible = false; if (PageNumber == GenericMessagePageNumber) { GenericMessageControl.Visible = true; } } }
protected void SubmitForm(object sender, EventArgs e) { SavePage(); DataAccess oDataAccess = new DataAccess(); FQDNN_Form oForm = oDataAccess.GetFullForm(FormID); FormSettings oFormSettings = new FormSettings(); FormSettings.FormRedirectActions redirection = oFormSettings.GetRedirectAction(oForm.FQDNN_FormSetting.ToList()); //perform different redirects after submitting form if (redirection == FormSettings.FormRedirectActions.RedirectToUrl) { string redirectUrl = oFormSettings.GetRedirectUrlAfterFiling(oForm.FQDNN_FormSetting.ToList()); if(!String.IsNullOrEmpty(redirectUrl)) { Response.Redirect(redirectUrl); } else { redirection = FormSettings.FormRedirectActions.GenericFinishedMessage; } } if (redirection == FormSettings.FormRedirectActions.RedirectToTab) { int redirectTabID = oFormSettings.GetRedirectTabAfterFiling(oForm.FQDNN_FormSetting.ToList()); if (redirectTabID > 0) { Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(redirectTabID)); } else { redirection = FormSettings.FormRedirectActions.GenericFinishedMessage; } } if (redirection == FormSettings.FormRedirectActions.GenericFinishedMessage) { PageNumber = GenericMessagePageNumber; SetupForm(); } }