Follow by Email

Saturday, June 15, 2013

Using jQuery autocomplete plugin in asp.net | jQuery text autocomplete example ,tutorial

hi in this post i will show how to use a jQuery text autocomplete plugin in asp.net.

Example :

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <title></title>
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
    <script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
    <script type="text/javascript" language="javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    <script type="text/javascript">
        $(function () {
            var availableTags = [
      "ARMADA",
      "ASTON MARTIN",
      "MAZDA",
      "FORD",
      "FERRARI",
      "LAMBORGINI",
      "MERC",
      "HYUNDAI",
      "HUMMER",
      "TATA",
      "RR",
      "TOYOTA",
      "MITSUBISHI",
      "VOLVO"
    ];
            $("#TextBox1").autocomplete({
                source: availableTags
            });
        });
    </script>
</head>
<body>
    <form runat="server">
    <asp:Label ID="Label1" runat="server" Text="Enter Text "></asp:Label>
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    </form>
</body>
</html>

Result :