Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Total newbie - form redirect using runat="server" - please help

Reply
Thread Tools

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

 
 
Quinniee
Guest
Posts: n/a
 
      02-28-2006
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.

 
Reply With Quote
 
 
 
 
Hari
Guest
Posts: n/a
 
      02-28-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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.
>



 
Reply With Quote
 
 
 
 
Quinniee
Guest
Posts: n/a
 
      02-28-2006
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

 
Reply With Quote
 
Siva
Guest
Posts: n/a
 
      02-28-2006

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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
>



 
Reply With Quote
 
Quinniee
Guest
Posts: n/a
 
      02-28-2006
Yes, exactly...I'm unsure where to put the reponse.redirect.

 
Reply With Quote
 
Hari
Guest
Posts: n/a
 
      02-28-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) oups.com...
> Yes, exactly...I'm unsure where to put the reponse.redirect.
>



 
Reply With Quote
 
Quinniee
Guest
Posts: n/a
 
      02-28-2006
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.

 
Reply With Quote
 
Quinniee
Guest
Posts: n/a
 
      02-28-2006
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 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 Removed)" ID="Hidden1">
</form>

 
Reply With Quote
 
Hari
Guest
Posts: n/a
 
      03-01-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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 = "(E-Mail 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 Removed)" ID="Hidden1">
> </form>
>



 
Reply With Quote
 
Quinniee
Guest
Posts: n/a
 
      03-02-2006
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?

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
BT Total Broadband vs BT Business Total John Y UK VOIP 2 02-02-2007 09:27 AM
reset form - from a total newbie =?Utf-8?B?a2VpdGg=?= ASP .Net 3 11-03-2004 11:03 PM
reset form - from a total newbie =?Utf-8?B?a2R0?= ASP .Net 1 11-02-2004 09:38 PM
Basic Q - Response.Redirect, all redirect to first Response.Redirect statement Sal ASP .Net Web Controls 1 05-15-2004 03:46 PM
please help... ...me learn C++ please please please :) KK C++ 2 10-14-2003 02:08 PM



Advertisments