Jump to content

Postback to form with values filled in?


twilitegxa

Recommended Posts

I need help with the following form:

 

page one:

form

 

page two:

summary of form values,

confirm button (takes to default.aspx),

cancel button (takes back to form with values still filled in)

 

I have these pages currently:

 

page one:

<!-- UserForm.aspx -->
<%@ Page Language="VB" ClassName="SenderClass" %>

<script runat="server">
    ' Readonly property for name
    Public ReadOnly Property Name() As String
        Get
            Return USerName.Text
        End Get
    End Property

    'Readonly Property for phone
    Public ReadOnly Property Phone() As String
        Get
            Return UserPhone.Text
        End Get
    End Property

    'Event to transfer page control to Result.aspx
    Sub Page_Transfer(sender As Object, e As EventArgs)
        Server.Transfer("Result.aspx")
    End sub
</script>

<html>
<head>
</head>
<body>
    <form id="Form1" runat="server">
        User Name: 
        <asp:TextBox ID="UserName" runat="server" />
        Phone: 
        <asp:TextBox ID="UserPhone" runat="server" /><br>
        <asp:Button ID="Button1" Text="Submit" OnClick="Page_Transfer"
            runat="server" />
    </form>
</body>
</html>

 

page two:

<!-- Result.aspx -->
<%@ Page Language="VB" %>
<%@ Reference Page="UserForm.aspx" %>

<script runat="server">
    Dim result As SenderClass

    Sub Page_load(obj as Object, e as EventArgs)
        Dim content As String

        If Not IsPostBack Then
            result = CType(Context.Handler, SenderClass)
            content = "Name: " + result.Name + "<br>" _
                + "Phone: " + result.Phone
            Label1.text = content
        End If
    End Sub

</script>
<html>
<head>
</head>
<body>
<h1>Summary:</h1>
    <i><form id="Form1" runat="server">
        <asp:Label id="Label1" runat="server" /></i><br /><br />
    <asp:Button ID="Confirm" runat="server" Text="Confirm" 
            PostBackUrl="default.aspx" />
         
    <asp:Button ID="Cancel" runat="server" Text="Cancel" /></form>
</body>
</html>

 

Page two displays the summary, and has the confirm and cancel button. I have confirm set to go to the default.aspx page, but how do I get the cancel button to take the user back to the form (userform.aspx) with the form fields filled in with the previous data the user had filed in?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.