Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Redirecting to another page after form submitsRedirecting to another page after form submits
Previous
 
Next
New Post
7/23/2014 2:07 PM
 

How do you redirect to another page after firing the submit button?

 My code for my button in Asp.NET is

<asp:button id="btnClear2" cssclass="dnnSecondaryAction " runat="server" resourcekey="Submit"
      onclick="btnSubmit_Click" />

and then it is passed on to C# DNN fucntion to complete the event handling when it's fired, where it sends an email out, upload the files to the server and creates a folder.

The problem is, when its done, it redirects back to itself with a fresh form.

I'm assuming Server side form control is designed to post-back to self... When I viewsource in the web browser, the action is designated to itself.

How can I fix this?

 
New Post
7/23/2014 5:58 PM
 
Hi Kane,

In your server code, when you're done processing call Response.Redirect() with the URL of the target page.

Best,
Kelly

Create simple forms or build complete module solutions XMod Pro is the best-selling forms and views module of all time.
 
New Post
7/23/2014 6:03 PM
 
I've tried adding the Response.Redirect() with the URL, at the end of the function, but it still doesn't work.
 
New Post
7/24/2014 7:43 AM
 
It should work as I've done this many times myself.

Post your code so we can see what's going on.

Mark
 
New Post
7/24/2014 11:53 AM
 
Here is the code for the submit button function.

protected void btnSubmit_Click(object sender, EventArgs e)
{
Azshops az = new Azshops();
string foldername = System.String.Empty;
DateTime nowdate = DateTime.Now;
foldername = nowdate.ToString(datePatt);

makeFolder(string.Format("{0}{1}", az.MpPath, foldername));

RadUpload1.TargetPhysicalFolder = string.Format("{0}{1}", az.MpPath, foldername);

var dt1 = filldate( DateNeeded.SelectedDate);
var dt2 = filldate(DeskCopyDateNeeded.SelectedDate);

UploadedFile file;

MPOrderForm m;
m = new MPOrderForm
{
AssignedUserId = UserId
,
CreatedByUserId = UserId
,
CreatedOnDate = DateTime.Now
,
FirstName = txtFirstName.Text.Trim()
,
LastName = txtLastName.Text.Trim()
,
Email = txtEmail.Text.Trim()
,
Campus = txtCampus.Text.Trim()
,
Department = txtDepartment.Text.Trim()
,
OfficePhone = txtOfficePhone.Text.Trim()
,
HomePhone = txtHomePhone.Text.Trim()
,
Author = txtAuthor.Text.Trim()
,
Title = txtTitle.Text.Trim()
,
Semester = txtSemester.Text.Trim()
,
DateNeeded = dt1
,
Course = txtCourse.Text.Trim()
,
SectionNumbers = txtSectionNumbers.Text.Trim()
,
EstEnrollment = fillInt(txtEstEnrollment.Text)
,
ReqOpt = fillBool(rdoReqOpt.Items[0])
,
ProductIs = myProductIs.Value
,
CopyRightClearance = fillBool(rdoCopyRightClearance.Items[0])
,
RequireCopyRightQuote = fillBool(rdoRequireCopyRightQuote.Items[0])
,
DeskCopyQty = txtDeskCopyQty.Text.Trim()
,
DeskCopyDateNeeded =dt2

,
ProofCopy = fillBool(rdoProofCopy.Items[0])
,
PrintingStyle = myPrintingStyle.Value
,
CoverColor = myCoverColor.Value
,
CustomCover = myCustomCover.Value
,
//BindingOption = ddlBindingOptions.SelectedValue
BindingOption =myBindingOption.Value
,
PaginationRequired = fillBool(rdoPaginationRequired.Items[0])
,
TOC = fillBool(rdoTOC.Items[0])
,
AdditionalSupplies = txtAdditionalSupplies.Text.Trim()
,
SpecialInstructions = txtSpecialInstructions.Text.Trim()
,
Attachments = formHasAttachments(RadUpload1.UploadedFiles.Count)
,
OkToSubmit = true
};

m.OnlineFormId= OnlineOrderFormController.SaveOnlineForm(m, this.PortalId, this.ModuleId, this.TabId);

string fname = System.String.Empty;
string lname = System.String.Empty;
string campus = System.String.Empty;
string dept = System.String.Empty;
//Firstname
if (m.FirstName.Length >= 1)
{
fname = m.FirstName.Substring(0, 1);
}
else
{
fname = "f";
}

//Lastname
if (m.LastName.Length >= 3)
{
lname = m.LastName.Substring(0, 3);
}
else if (m.LastName.Length >= 2)
{
lname = m.LastName.Substring(0,2);
}
else if (m.LastName.Length >= 1)
{
lname = m.LastName.Substring(0, 1);
}
else
{
lname = "l";
}

//Campus
if (m.Campus.Length >= 4)
{
campus = m.Campus.Substring(0, 4);
}
else if (m.Campus.Length >= 2)
{
campus = m.Campus.Substring(0, 2);
}
else if (m.Campus.Length >= 1)
{
campus = m.Campus.Substring(0, 1);
}
else
{
campus = "c";
}


//Dept
if (m.Department.Length >= 3)
{
dept = m.Department.Substring(0, 3);
}
else if (m.Department.Length >= 2)
{
dept = m.Department.Substring(0, 2);
}
else if (m.Department.Length >= 1)
{
dept = m.Department.Substring(0, 1);
}
else
{
dept = "d";
}


foldername = string.Format("{0}{1}{2}{3}",fname,lname,campus,dept);






RadProgressContext progress = RadProgressContext.Current;

RadProgressArea1.ProgressIndicators = RadProgressArea1.ProgressIndicators | ~ProgressIndicators.SelectedFilesCount;
RadProgressArea1.Localization.UploadedFiles = "Processed";
RadProgressArea1.Localization.TotalFiles = "";
RadProgressArea1.Localization.CurrentFileName = "File: ";



progress.SecondaryPercent = "0";
progress.SecondaryValue = "0";
progress.SecondaryTotal = "0";


//rename the uploaded file to suffix to aid in locating files
foreach (UploadedFile f in RadUpload1.UploadedFiles)
{
string targetfolder = string.Format(@"{0}\{1}\",RadUpload1.TargetPhysicalFolder,foldername);


makeFolder(string.Format("{0}", targetfolder));
string filename = string.Format("{0}{1}", targetfolder, f.FileName);
f.SaveAs(filename, true);
if (f.ContentLength > 0)
{
LooongMethodWhichUpdatesTheProgressContext(f);
}
}


if (RadUpload1.UploadedFiles.Count > 0)
{
labelNoResults.Visible = false;
repeaterResults.Visible = true;
repeaterResults.DataSource = RadUpload1.UploadedFiles;
repeaterResults.DataBind();
}
else
{
labelNoResults.Visible = true;
repeaterResults.Visible = false;
}





sndEmail(m, RadUpload1.UploadedFiles.Count);

Response.Redirect("submit.aspx");

}
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Using Modules a...Using Modules a...Redirecting to another page after form submitsRedirecting to another page after form submits


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out