Reputation: 65553
I dont know whether this simple task or not, but I tried to search in google but couldn't find anything.
I've a asp.net form and user enters some data in the text boxes provided. Whenever user submits the form, browser will save that form data. I don't want this form data to be saved in browser. How can I restrict the browser saving this form data without touching the browser settings?
Application is developed using asp.net and normal text boxes are used here.
Upvotes: 4
Views: 4344
Reputation: 68506
I'm guessing you mean you want the browser to stop remembering values entered, i.e. the browser's autocomplete?
<input type="text" name="text1" autocomplete="off">
Or this will work in FF and IE, but it's not XHTML standard:
<form name="form1" id="form1" autocomplete="off" />
Note that autocomplete
is only defined in the HTML 5 standards, so it will break any validations you run against HTML 4.
If not, on PostBack, just clear the inputs:
TextBox.Text = string.Empty;
Upvotes: 11
Reputation: 2642
If you're meaning an asp:TextBox
with "[...]normal text boxes[...]", then the control's ControlState
is responsible for saving the entered value. Unfortunately, you can't disable the ControlState
(MSDN).
Upvotes: 0