Clearing Post Data

D

David P. Donahue

I have an ASP .NET website where users submit comments and, depending on
whether or not the web service accepting the comments returns an error,
the form uses this.page.registerstartupscript() to popup a dialog box
confirming that the submission was received.

It seems that, after this takes place, the resulting page still has the
form data (even though the form elements have been cleared). Thus, a
refresh of the page re-submits the data. Is there a way to clear the
post data without using a Response.Redirect(), since that will render
the startupscript function useless?
 
P

Peter Rilling

What I usually do is perform a Redirect back to the page so that is acts
like this is the first time visiting the page.

For instance, you might do something like
Response.Redirect("MyPage.aspx?param1=..."). This would be called at some
point before the page renders. Maybe at the end of the Page_Load, or
someplace after your code.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top