locked
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">
    </asp:CalendarExtender>

    Monday, May 28, 2018 6:08 AM

All replies

  • User753101303 posted

    Hi,

    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.

    https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion

    https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.autocompletetype%28v=vs.110%29.aspx

    Any feedback would be appreciated.

     

    Best Regards,

    Abraham

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

    Hi ,

    can you try this

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

    OR

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

    Hope it helps

    Regards,

    Wednesday, May 30, 2018 7:49 AM