Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Total newbie - form redirect using runat="server" - please help (http://www.velocityreviews.com/forums/t120531-total-newbie-form-redirect-using-runat-server-please-help.html)

Quinniee 02-28-2006 04:58 AM

Total newbie - form redirect using runat="server" - please help
 
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.


Hari 02-28-2006 06:34 AM

Re: Total newbie - form redirect using runat="server" - please help
 
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



"Quinniee" <KerryAQuinn@gmail.com> wrote in message
news:1141102683.851838.171420@v46g2000cwv.googlegr oups.com...
>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.
>




Quinniee 02-28-2006 01:43 PM

Re: Total newbie - form redirect using runat="server" - please help
 
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="/wEPDwUKMTQwOTQ2NDU5MQ9kFgJmD2QWLgIBDw8WAh4HVmlzaWJ sZWhkZAIHDw8WAh4SRW5hYmxlQ2xpZW50U2NyaXB0aGRkAgsPD xYCHwFoZGQCDw8PFgIfAWhkZAITDw8WAh8BaGRkAhcPDxYCHwF oZGQCGw8PFgIfAWhkZAIfDw8WAh8BaGRkAiMPDxYCHwFoZGQCJ w8PFgIfAWhkZAIrDw8WAh8BaGRkAi8PDxYCHwFoZGQCMw8PFgI fAWhkZAI3Dw8WAh8BaGRkAjsPDxYCHwFoZGQCPw8PFgIfAWhkZ AJDDw8WAh8BaGRkAkcPDxYCHwFoZGQCSw8PFgIfAWhkZAJPDw8 WAh8BaGRkAlMPDxYCHwFoZGQCVw8PFgIfAWhkZAJbDw8WAh8Ba GRkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxY KBRJMb2FuVHlwZUluZGl2aWR1YWwFDUxvYW5UeXBlSm9pbnQFD UxvYW5UeXBlSm9pbnQFBWN0bDM1BQVjdGwzNgUFY3RsMzcFBWN 0bDM4BQVjdGwzOQUFY3RsNDEFBWN0bDQyHKoQGB0FQg9Y2mz+3 33r+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=63 2675822768906250"
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


Siva 02-28-2006 03:42 PM

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

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=63 2675822768906250"

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





"Quinniee" <KerryAQuinn@gmail.com> wrote in message
news:1141134196.311133.162250@p10g2000cwp.googlegr oups.com...
> 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="/wEPDwUKMTQwOTQ2NDU5MQ9kFgJmD2QWLgIBDw8WAh4HVmlzaWJ sZWhkZAIHDw8WAh4SRW5hYmxlQ2xpZW50U2NyaXB0aGRkAgsPD xYCHwFoZGQCDw8PFgIfAWhkZAITDw8WAh8BaGRkAhcPDxYCHwF oZGQCGw8PFgIfAWhkZAIfDw8WAh8BaGRkAiMPDxYCHwFoZGQCJ w8PFgIfAWhkZAIrDw8WAh8BaGRkAi8PDxYCHwFoZGQCMw8PFgI fAWhkZAI3Dw8WAh8BaGRkAjsPDxYCHwFoZGQCPw8PFgIfAWhkZ AJDDw8WAh8BaGRkAkcPDxYCHwFoZGQCSw8PFgIfAWhkZAJPDw8 WAh8BaGRkAlMPDxYCHwFoZGQCVw8PFgIfAWhkZAJbDw8WAh8Ba GRkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxY KBRJMb2FuVHlwZUluZGl2aWR1YWwFDUxvYW5UeXBlSm9pbnQFD UxvYW5UeXBlSm9pbnQFBWN0bDM1BQVjdGwzNgUFY3RsMzcFBWN 0bDM4BQVjdGwzOQUFY3RsNDEFBWN0bDQyHKoQGB0FQg9Y2mz+3 33r+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=63 2675822768906250"
> 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
>




Quinniee 02-28-2006 03:56 PM

Re: Total newbie - form redirect using runat="server" - please help
 
Yes, exactly...I'm unsure where to put the reponse.redirect.


Hari 02-28-2006 04:10 PM

Re: Total newbie - form redirect using runat="server" - please help
 
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



"Quinniee" <KerryAQuinn@gmail.com> wrote in message
news:1141142208.096407.226900@j33g2000cwa.googlegr oups.com...
> Yes, exactly...I'm unsure where to put the reponse.redirect.
>




Quinniee 02-28-2006 05:40 PM

Re: Total newbie - form redirect using runat="server" - please help
 
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.


Quinniee 02-28-2006 07:02 PM

Re: Total newbie - form redirect using runat="server" - please help
 
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 = "kerryaquinn@gmail.com" %>

<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="kerryaquinn@gmail.com" ID="Hidden1">
</form>


Hari 03-01-2006 06:19 AM

Re: Total newbie - form redirect using runat="server" - please help
 
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



"Quinniee" <KerryAQuinn@gmail.com> wrote in message
news:1141153321.337451.98430@v46g2000cwv.googlegro ups.com...
>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 = "kerryaquinn@gmail.com" %>
>
> <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="kerryaquinn@gmail.com" ID="Hidden1">
> </form>
>




Quinniee 03-02-2006 12:49 AM

Re: Total newbie - form redirect using runat="server" - please help
 
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?



All times are GMT. The time now is 05:30 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.