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

Discussion in 'ASP .Net' started by Quinniee, Feb 28, 2006.

  1. Quinniee

    Quinniee Guest

    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, Feb 28, 2006
    #1
    1. Advertising

  2. Quinniee

    Hari Guest

    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" <> wrote in message
    news:...
    >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, Feb 28, 2006
    #2
    1. Advertising

  3. Quinniee

    Quinniee Guest

    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
     
    Quinniee, Feb 28, 2006
    #3
  4. Quinniee

    Siva Guest

    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





    "Quinniee" <> wrote in message
    news:...
    > 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
    >
     
    Siva, Feb 28, 2006
    #4
  5. Quinniee

    Quinniee Guest

    Yes, exactly...I'm unsure where to put the reponse.redirect.
     
    Quinniee, Feb 28, 2006
    #5
  6. Quinniee

    Hari Guest

    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" <> wrote in message
    news:...
    > Yes, exactly...I'm unsure where to put the reponse.redirect.
    >
     
    Hari, Feb 28, 2006
    #6
  7. Quinniee

    Quinniee Guest

    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, Feb 28, 2006
    #7
  8. Quinniee

    Quinniee Guest

    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 = "" %>

    <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="" ID="Hidden1">
    </form>
     
    Quinniee, Feb 28, 2006
    #8
  9. Quinniee

    Hari Guest

    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" <> wrote in message
    news:...
    >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 = "" %>
    >
    > <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="" ID="Hidden1">
    > </form>
    >
     
    Hari, Mar 1, 2006
    #9
  10. Quinniee

    Quinniee Guest

    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?
     
    Quinniee, Mar 2, 2006
    #10
  11. Quinniee

    Hari Guest

    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
     
    Hari, Mar 2, 2006
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matthew Louden
    Replies:
    4
    Views:
    13,194
    Teemu Keiski
    Nov 18, 2003
  2. ola

    Form tag with runat=server

    ola, Nov 28, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    11,562
    rakesh.mwisp
    Sep 8, 2008
  3. =?Utf-8?B?dHJpbml0eXBldGU=?=

    must be placed inside a form tag with runat=server with inheritanc

    =?Utf-8?B?dHJpbml0eXBldGU=?=, Dec 21, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    7,756
    Steven Cheng[MSFT]
    Dec 22, 2004
  4. =?Utf-8?B?d3J5dGF0?=

    form in a form that runat server?

    =?Utf-8?B?d3J5dGF0?=, Jun 7, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    442
    Steve C. Orr [MVP, MCSD]
    Jun 7, 2005
  5. André
    Replies:
    2
    Views:
    794
    André
    Jun 23, 2008
Loading...

Share This Page