I am using asp.net 3.5 (codebehind c#). My users are running IE 7 or 8. I have a data entry page with several TextBoxes.
When I want to clear the all the TextBoxes, I do a sever.transfer back to the same page.
Maybe 99% of the time, this clears the TextBoxes. Every so often it does not.
I know that a roundtrip to the server has happened because:
- The dropdown lists and radiobuttonlists on the page get reset, and
- DB processing happened as shown by a record having been saved to the
DB.
The inconsistency is confusing me.
What could be causing the TextBoxes to persist data in this way and how can I prevent it from ever happening?
It is resulting in users saving the same data twice.
I don’t think this would have anything to do with it, but there are also various js functions on the page for validation, capitalizing the first letter of an input, etc
As this MSDN article describes the Server.Transfer method, this is probably not the right way to empty the
TextBoxes. The method explicitly keeps all state information.A better approach is described within this answer:
You will keep the roundtrips to just one, and you could keep all other user inputs as they were, if you like.