Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hello all,
I ahve a web form where i am submitting personal information like name,age etc.when I save the information i cleared the text box values.I have also false the view state of text box.but if i have entered amit in name and save it.Second time if i fill information again something like name as arvind then the amit name is also coming down there.how to clear the previous value after postback
Posted 26-Oct-10 2:12am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

Hi,
 
Go to the design page of your screen,there you can find the
FORM tag.
 
You can find the AutoComplete property.Then set that value as "OFF".
Thats it.
 
If this property is not showing in your page also just write this property manually.
 
Regards,
Kiran.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

Use AutoCompleteType property of text box.
 
<asp:TextBox ID="TextBox1" AutoCompleteType="disabled" runat="server"></asp:TextBox>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Use This Function
 
public void EmptyControlData(Control parent)
    {
        foreach (Control c in parent.Controls)
        {
            if ((c.GetType() == typeof(TextBox)))
            {
                ((TextBox)c).Text = "";
            }
            if ((c.GetType() == typeof(DropDownList)))
            {
                ((DropDownList)c).SelectedIndex = -1;
                //((DropDownList)c).Items.Clear();
            }
            if (c.HasControls())
            {
                EmptyControlData(c);
            }
        }
    }
 
Here parent is this.
  Permalink  
Comments
Hiren Solanki at 27-Oct-10 7:37am
   
good way to clearize using javascript.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hi,
 
This problem is called the Cacheing the browser data(Read Cache concept in ASP.NET).
You can solve this problem by making AutoComplete property of Form Tag of your page set as "OFF".
 
or
 
you need to clear the your page Cache data manually.
 
Regards,
Kiran.
  Permalink  
Comments
AmitChoudhary10 at 27-Oct-10 7:33am
   
i am also facing same problem,i don't want user to see past records filled in text boxes.From where can i set AutoCompleteProperty to off?...
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Example:
 
if (IsPostBack)
        {
          textbox1.text = "";
         }
 
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

clear the textbox after display message using javascript in asp.net
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

add in form tag <form autocomplete="off"> other wise set the textbox property autocomplete="off"</form>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 8

set the textbox property autocomplete="off"
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 24 Oct 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100