Clearing Form

S

Shahid Juma

Hi,

I have a form and when the user clicks save, it will add all the
details to the database. However, when I add it to the database, how do
I clear the form values? What happens is that it updates a label which
I added informing that it was saved but the form is still filled in
with values.

Any ideas?

Thanks in advance,
Shahid
 
G

Grant Merwitz

Yes, you clear each textbox in the form.

TextBox1.Text = "";
TextBox2.Text = "";


Alternately, redirect the user back to the same page, and the textbox's will
be cleared.

Response.Redirect("yourpage.aspx");

Then to use a ResponseMessage, you can post a parameter
like:

Response.Redirect("yourpage.aspx?SUCCESS=true"); //Remembering to clear that
on post back,

But option 1 (clearing the textboxes) is probally easier and removes the
need to reload the whole page
 

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

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top