Hi, Whats the normal procedure of clearing a form after POST? Just loop through the textboxes and cleat all text? I have an ASP.NET application with several forms and I am trying to avoid them sending the data twice?
Thanks
Hi, Whats the normal procedure of clearing a form after POST? Just loop through the textboxes and cleat all text? I have an ASP.NET application with several forms and I am trying to avoid them sending the data twice?
Thanks
You can inject some javascript code to execute after postback.
document.forms[0].reset();
document.forms[1].reset();
From server side, I haven't found an easy way to reset the form contents other than iterating through the controls inside a loop or doing a Server.Transfer back to the same page.
You can avoid double sending/doing by putting your code inside an if(!isPostBack) block. This will tell the page not to do the specified actions when posting.