Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Submitted

Status
Not open for further replies.

A1Pat

IS-IT--Management
Jun 7, 2004
454
US
Hi all,

I'm doing a form and having a small question that hoping someone can provide a better idea for me to get to how I want my form to do after submitted.

Right now, all I can do is response.redirect the form to itseft with a note says Thank You!!! in order to avoid the form keeps re-submitted when user refresh the page again and again.

However, I'd like to have the page to display thank you note with all the information entered after being submitted, and I'm thinking of utilizing Session for every fields to do just that because I don't think any data can be held after response.redirect.

Question:
-Do you have any better idea to do so?
-If Session is the way, is there a limit for number of Session(s) to be used?

Thanks!
 
I'm sure you'll a few different responses to this. My preferred method would be to Response.Redirect to your thankyou page, then run a stored procedure that pulls back all the data from your most recently inserted row and display it on your thankyou page.

 
Why not just display the tahnk you on the same page? That way you will have access to all the information the user entered without the extra trip to the database or the extra memory of saving a session variable.


____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Oh, I forgot to mention that I don't have database for this form, merely email response.

To markknowsley: Could you elaborate a little more about "run a stored procedure that pulls back all the data from your most recently inserted row and display it on your thankyou page" that you mentioned so that I can have a better understanding. As I said I'm not interested in having database for this form, so "pulls back all the data" without using Session and, in the same time, avoid having the problem re-sent the email when users refresh would be the way I'm looking for.

Thanks!
 
And, an example about how to do just that would be great...
 
I re-read Mark opinion and I'm sorry for not reading more carefully.

Ok... it is "default", to me, that the form will automatically submitted and re-post all the fields with entered data after posted and if I want, an extra note Thank You will also be posted along with all of that easily. At least, I got that much.

The problem that I'm facing (and I had your help before) is how to avoid having the form to re-send again and again when user refreshing the posted page after he/she'd already submitted it once. And as I got help from you earlier, response.redirect is the great way to avoid such incident. However, all the data submitted will be lost and I can not find a better way than utilizting Session to re-post the data for user to view, then using Session.Abandon() afterward. And so far, it work OK for me.

Now, I'd like to know whether there is a better way(s)? If not, is there a limitted number of Session to use, or would you recommend this technique at all?

P.S. No database please!
 
In that case, you could just use a panel for each section e.g.
Code:
        <asp:Panel ID="pnlEnter" runat="server">
            <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <asp:Button ID="Button1" runat="server" Text="Button" />
        </asp:Panel>
        <asp:Panel ID="pnlThankYou" runat="server">
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
        </asp:Panel>
Code:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        pnlEnter.Visible = True
        pnlThankYou.Visible = False
    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Label1.Text = "Thank you. You entered: " & TextBox1.Text
        pnlEnter.Visible = False
        pnlThankYou.Visible = True
    End Sub




____________________________________________________________
Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]

Need help finding an answer? Try the Search Facility or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top