Total newbie - form redirect using runat="server" - please help

Q

Quinniee

I have inherited a asp.net (which I know nothing about) site and i'm
attempting to redirect to another page after the form is submitted.
Right now the form validates some required info, submits, emails the
results to a static email address, then basically resets the form. I'm
looking to simply redirect to a "thank you" page after the form has
been submitted and the email has been sent. I'm not sure what code
will help but here are some snippets.

<form name="my form" runat="server">

<asp:Button runat="server" Text="Submit" CausesValidation="true"
OnClick="SubmitButton_Click" />

When I look at the HTML of the created aspx page I can see it creates
some javascript and uses webresources.axd.

I would GREATLY appreciate any help.
 
H

Hari

Hi,

You can use

Response.Redirect("Thankspage.aspx"); inside the SubmitButton_Click after
the said conditions are met.

the code will look something like this.

Private void SubmitButton_Click(.............)
{
//Include the below code after all the process you mentioned gets over.
if(ConditionsMet)
{
Response.Redirect("Thankspage.aspx");
}
}

Hope this helps.

BestRegards,
Hari
 
Q

Quinniee

Well unfortuanetly I have not figured out where that codes lies. It's
not on my aspx page, does this get generated somehow when the page is
created? After the <form> tag, this code appears in the html.

<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=""
/>
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT"
value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUKMTQwOTQ2NDU5MQ9kFgJmD2QWLgIBDw8WAh4HVmlzaWJsZWhkZAIHDw8WAh4SRW5hYmxlQ2xpZW50U2NyaXB0aGRkAgsPDxYCHwFoZGQCDw8PFgIfAWhkZAITDw8WAh8BaGRkAhcPDxYCHwFoZGQCGw8PFgIfAWhkZAIfDw8WAh8BaGRkAiMPDxYCHwFoZGQCJw8PFgIfAWhkZAIrDw8WAh8BaGRkAi8PDxYCHwFoZGQCMw8PFgIfAWhkZAI3Dw8WAh8BaGRkAjsPDxYCHwFoZGQCPw8PFgIfAWhkZAJDDw8WAh8BaGRkAkcPDxYCHwFoZGQCSw8PFgIfAWhkZAJPDw8WAh8BaGRkAlMPDxYCHwFoZGQCVw8PFgIfAWhkZAJbDw8WAh8BaGRkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYKBRJMb2FuVHlwZUluZGl2aWR1YWwFDUxvYW5UeXBlSm9pbnQFDUxvYW5UeXBlSm9pbnQFBWN0bDM1BQVjdGwzNgUFY3RsMzcFBWN0bDM4BQVjdGwzOQUFY3RsNDEFBWN0bDQyHKoQGB0FQg9Y2mz+333r+PpzKRY="
/>
</div>

<script type="text/javascript">
<!--
var theForm = document.forms['ctl00'];
if (!theForm) {
theForm = document.ctl00;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
// -->
</script>

<script
src="/WebResource.axd?d=TnDA7ORapnLF3ng17MGRZQ2&amp;t=632675822768906250"
type="text/javascript"></script>

Sorry be so clueless but I obviously missing something here. I'd be
happy to give the link if anyone is willing to take a look at it.

Thanks
 
S

Siva

Hi ,

Your question so unclear , what exactly you want here to be done , which
code , you were unabel to see?

Leave the below lines mentioned by you , becuase these are generatesd
automatically , and seems like you are using ASP.Net2.0 (some control might
have generate the resources like this )

src="/WebResource.axd?d=TnDA7ORapnLF3ng17MGRZQ2&amp;t=632675822768906250"

I dont think this will help .

Ok from my understanding are you struggling to add this
line?Response.Redirect("Thankspage.aspx"); in appropriate places?

Best regards,
A.Sivakumar
 
H

Hari

Hi,

Can you send some of your corresponding code in aspx.cs page here or to me
in mail.( i/anyone will update the code later)
As i mentioned inside the somepage.aspx.cs file's button click event , you
can do this . can you please take a look on my code and see
what exactly you were missing?

Best Regards,
Hari
 
Q

Quinniee

Actually, that's why I'm so confused, there is basically nothing in
aspx.cs page. Here it is.

// C# Document
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web;
using System.Web.UI;
using System.Collections;

namespace DiamondD {
public class LoanApp : Page {
}

}

I can't seem to find anywhere that defines SubmitButton_Click.
 
Q

Quinniee

I stripped down the aspx page (hopefully not of anything important) in
case this will give anyone more clues.

<%@ Page Language="JScript" ContentType="text/html"
Inherits="DiamondD.LoanApp" ResponseEncoding="iso-8859-1"
aspcompat="true" Debug="true" AutoEventWireup="True" %>

<% var title = "Loan Application"; %>
<% var emailRecipient = "(e-mail address removed)" %>

<form name="loanapp" runat="server" ID="Form1">
<span class="Body12">
<asp:ValidationSummary runat="server" ID="Summary"
EnableClientScript="true"
HeaderText="Please complete the following fields:" />

</span>
<asp:RadioButton runat="server"
ID="LoanTypeIndividual" GroupName="LoanType" Text="an Individual Loan"
value="individual" Checked="true"/>
<asp:RequiredFieldValidator runat="server" Text="*"
ErrorMessage="First Name" ControlToValidate="FirstName" Visible="true"
EnableClientScript="true" />
First Name:<input type="text" id="FirstName" size="15"
runat="server" NAME="FirstName"/>
<asp:RequiredFieldValidator runat="server" Text="*"
ErrorMessage="Middle Name" ControlToValidate="MI" Visible="true" />
Middle Name/Initial:<input type="text" id="MI" size="15"
runat="server" NAME="MI"/>
<asp:Button runat="server" Text="Submit"
CausesValidation="true" OnClick="SubmitButton_Click" />
<span class="content">
<input type="reset" name="Reset" value="Reset"
ID="Reset1">
<input type="hidden" name="appRecipient"
value="(e-mail address removed)" ID="Hidden1">
</form>
 
H

Hari

Hi Quinne,

Surprized to see the code , Is it developed in asp(I am totally blank reg
asp ) I know only asp.net a little , but have never seen

// C# Document for a <%@ Page Language="JScript" ....

I think something is missing in general , did you did any conversion , so
that this happens , and what happens when you try to debug the code in
server side on button click ? Did you tried? , "I have never used or seen a
JScript Code " so less helpful reg the issue , but i think you can set a
break point and debugging the code should guide you i guess.

Regards,
Hari
 
Q

Quinniee

I deleted the aspc.cs file from server and form still emails the
results...is that normal or does this mean that .cs file is really not
being used?

Hari, I did not do any conversion, I basically downloaded the aspx page
from the webserver. Unfotunatly when I try to debug i get all kinds
of errors that will not allow the debug to run.

I have finally found the SubmitButton_Click in a dll file. Does that
provide any clues?
 
H

Hari

Hi Quinnie,

Can you direct me to the exact dll and aspx page(if i can download if it is
some sample) /if the pages are not confidential , you can send it , let me
have a look , if i can do something , I can't assure you , but can just try
to figure out what the deal is.

Btw, do you really want that proj to be modified or you were trying to
create some new with same ideas ( i guess by the time you might have
created a new with that facility)

I have finally found the SubmitButton_Click in a dll file. Does that
provide any clues?

Yes , we no need of the cs file when we deploy a aspx project , so we will
have to recreate the cs page if it doesnt exist any where.

Regards,
A.Sivakumar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top