<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Jquery AutoComplete TextBox Demo</title>
<link href="css/jquery-ui.min.css" rel="stylesheet" type="text/css"/>
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery-ui.min.js" type="text/javascript"></script>
</head>
<body>
<h2>Jquery Auto Complete TextBox Demo</h2>
<hr>
<form id="form1" runat="server">
<div>
<label id="lblname">Categories:</label>
<asp:TextBox ID="txtCategories" runat="server"></asp:TextBox>
</div>
</form>
<script>
$(document).ready(function () {
SearchTextBox();
});
function SearchTextBox() {
$("#txtCategories").autocomplete({
source: function (request, response) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Default.aspx/GetBeverageDetails",
data: "{'sBeverageDetails':'" + document.getElementById('txtCategories').value + "'}",
dataType: "json",
success: function (data) {
response(data.d);
},
error: function (result) {
alert("No Match");
}
});
}
});
}
</script>
</body>
</html>
No comments:
Post a Comment