how to delete history of a text box RRS feed

  • Question

  • User1046245955 posted

    how to delete the history date in textbox using c# .net

    here's my code:

    <asp:TextBox ID="datefrom" runat="server" AutoPostBack="true" CssClass="form-control" placeholder="Date From" Width="20%" AutoCompleteType="Disabled"></asp:TextBox>

    <asp:CalendarExtender ID="c_date_from" runat="server" Format="dd-MMM-yyyy" TargetControlID="datefrom" Animated="true">

    Monday, May 28, 2018 6:08 AM

All replies

  • User753101303 posted


    What if using "view source" in your browser ? autocomplete is "off" but the browser still suggest past values ? Do you see the same behavior for other browsers ?

    AFAIK only the user can clear values previously recorded by the browser and still showing suggestions because you typed value in the past even if autocomplete is off would look like a browser bug. 

    Monday, May 28, 2018 6:54 AM
  • User-330142929 posted

    Hi Paminchever,

    Based on you codes, I tried to test it in various browsers and found it work well.

    Generally, Asp.net TextBox will render <input type=text /> on the client-sider. And the property “AutocompleteType=disabled” will generate the “autocomplete=off” which could disable autocomplete for form fields and delete history of a textbox.

    In some cases, the browser will continue suggesting autocompletion values even if the autocomplete attribute is set to off. So we could assign an invalid value to property, such as: autocomplete="nope”. But it failed when I tried to reproduce your problem when the autocomplete attribute was set to off.  Could you provide more details about your browser (like its version and type), so that we can solve your issue more effectively.

    For more information, please refer to this document.



    Any feedback would be appreciated.


    Best Regards,


    Wednesday, May 30, 2018 6:57 AM
  • User1623409651 posted

    Hi ,

    can you try this

    <asp:TextBox ID="TextBox1" autocomplete="off" runat="server"></asp:TextBox>


    TextBox1.Attributes.Add("autocomplete", "off")

    Hope it helps


    Wednesday, May 30, 2018 7:49 AM