AutoComplete-Auto Listing (frequently typed texts in TextBox) in ASP.NET
Introduction
Look at the image given below:
In the above image, you can see there are recently and
frequently used numbers are listed when I placed the cursor in the TextBox to
type something it comes up. Actually it happens by default and to stop this we
need to add special attribute to existing system.
In ASP.NET to deal or say top such default system we need to use
AutoCompete property of TextBox.
We can use AutoComplete property in HTML page as well as
code-behind.
From HTML Page
To turn-off the AutoComplete for any TextBox from HTML Page, we
need to use following:
<form id="Form1" method="post" runat="server" autocomplete="off">
OR
<form id="Form1" method="post" runat="server" autocomplete="off"
/>
OR
<asp:TextBox Runat="server" ID="Textbox1" autocomplete="off"></asp:TextBox>
From Code-Behind
To turn-off the AutoComplete for any TextBox from code-behind,
we need to use following:
Textbox1.Attributes.Add("autocomplete", "off");
So, that’s all about the AutoComplete in ASP.NET.

Comments
Post a Comment