Hi guys,

I've looked around and read, I'm not looking for a OnClientClick that can be added to the server side button. I need something that will direct anyone who clicks on submit to another page where they would see what they've filled out. Eventually, this will have their email address and etc (it will be a form) I would like to know how to get it to a confirmation page before I begin with adding additional things to the form. Confirmaton page obviously should allow them to view all of fields with the data they've entered.
For ex: we could work with Full Name: w/e they entered here
Confirmation page would display that, with the ability to Cancel or Confirm and Submit. // which updates the database at the point

Here's the code I've developed
NOTE: THE DATE IS HIDDEN TO THE END USER, let's just focus on getting to the next page

<%@ Page Language="VB"  debug="true" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<script runat="server">
Sub btnSubmit_OnClick(sender As Object, e As EventArgs)
Dim myConn As SqlConnection = New SqlConnection("Integrated Security=false;Data Source=test;Initial Catalog=Test;Persist Security Info=True;User ID=teradad34;Password=dasdada2")

myConn.Open()
Dim sqlstring As String = "INSERT INTO leaveform (Date) VALUES (getdate())"


Dim cmd As SqlCommand = New SqlCommand(sqlstring, myConn)
cmd.ExecuteNonQuery()
myConn.Close()
End Sub
</script>

<html>
<head>
<meta http-equiv="expires" content="0">
<title>Untitled Document</title>
</head>
<body>

<form method="POST" action="leaverequest.aspx" runat="server">
<asp:Button ID="btnSubmit" runat="server" Text="Submit"  OnClick="btnSubmit_OnClick" />
</form>
</body>
</html>

In ASP.NET, a form will allow you to post data, but it will post data to the same page unlike other server-side scripting languages.

There are many options for getting values from one page to a different page. For example, you can store the values the user has provided in session variables, then read those values on your confirmation page and then display them back to the user as you see fit.

If you want to post data back to the same page, you can have two panels, one for collecting the data, and another panel you show if the page was a post back [Page.IsPostBack()].

You could also store the values temporarily in a database table although you indicated that is not your preference.

Here's MSDN documentation on how to post to a different page: How to: Post ASP.NET Web Pages to a Different Page

Of course, an alternative is to modify lines 24-26 and not use Web Controls, but to use standard HTML controls. If you use a standard HTML Form, you can post data to any page you wish and then retrieve the form data using the request.form collection, such as Request.Form["parameter"].

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.