Need asp form to redirect after submit in Expression c#

Posted on 2008-11-06
Last Modified: 2010-04-21
Have managed to create an aspx page in Expression web using a few tutorials, with validators etc and everything is working OK but I need to know how to get the page to redirect to a thank you/confirmation page once the submit button is pressed. Have used some instruction from jimcobooks to create the form in C# but I have no knowledge of this programming language so struggling as you could imagine. I would also like to make the email take data form some of the text boxes in the form and use this as the subject of the email. Any help greatly appreciated.
Question by:pn944
    LVL 10

    Accepted Solution

    You have the register.aspx page or whatever, inside that page you have several controls TextBox, dropdown ...

    In 2.0 the principle of each page submit is the page postback to itself. And 1 aspx page should only have 1 form.

    When the page is posted back, you can access server control (which have property runat="server") and its property.

    <asp:TextBox ID="tbName" runat="server" />
    <asp:Button ID="btSubmit" runat="server" OnClick="btSubmit_Click" />

    protected void btSubmit_Click(object sender, EventArgs e)
            string name = tbName.Text;
           //get all  your data and send email
          Response.Redirect("successpage.aspx"); //this is to redirect to the success page

    Hope this give you some idea

    LVL 10

    Expert Comment

    If you want example to send email using C#, take a look at this, it's ready to run example. Copy and try it out


    Author Closing Comment

    Thanks for the quick response, sorted now, thanks again

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now